iOS basic notes (i)

Source: Internet
Author: User

1. Set the size of the button text to the button's own size button.size=[Button.currenttitle SizeWithFont:button.titleLabel.font]; Button.backgroundcolor=[Uicolor Redcolor]; 2. Common size /** 44:cell default height, navigation bar visible height 49:uitabbar default height 64: From the top of the window to the bottom of the navigation bar 20: status bar Height 320: Screen width on vertical screen 480: screen height of 3.5 inch in case of vertical screen 568: Screen height of 4.0 inch in vertical screen case*/ 3. TextView Change Notification #warning do not set your own proxy for yourself        //Monitor internal text changes//self.delegate = self;                /** Events for monitoring controls: 1.delegate 2.-(void) AddTarget: (ID) Target action: (SEL) Action forcontrolevents: (UIC         ontrolevents) controlevents; 3. Notice*/                //when the user modifies the text of self by using the keyboard, it automatically issues a uitextviewtextdidchangenotification notification//Once the above notification is issued, the Textdidchange method of self is called[[Nsnotificationcenter Defaultcenter] addobserver:self selector: @selector (textdidchange) Name: UitextviewtextdidchangenotificationObject: self];4. Copy policy, overriding setter method,- (void) Setplacehoder: (NSString *) placehoder{#warning If it's a copy strategy, the setter should write this. _placehoder = [placehoder copy];         //  Set text self.placehoderLabel.text = placehoder;  //  Recalculate the fame of the child controls, [self setneedslayout]; // re-layout child controls } 4. Uitabbar Bug fixes - (void) Tabbarcontroller: (Uitabbarcontroller *) Tabbarcontroller Didselectviewcontroller: (Uinavigationcontroller *) viewcontroller{Uiviewcontroller*VC =[Viewcontroller.viewcontrollers Firstobject]; if([VC Iskindofclass:[hmhomeviewcontrollerclass]]) {        if(Self.lastselectedviewcontoller = =vc) {[Self.home refresh:yes]; } Else{[Self.home refresh:no]; }} Self.lastselectedviewcontoller=VC;} Self.lastselectedviewcontoller=VC;  */* In fact there is a problem hidden here, if your 4 Tabbar are pointing to 4 navigationcontroller, then no problem, run OK. But if your 4 tabbar have any one point that is not Navigationcontroller, then the program will crash.     Because non-navigationcontroller cannot respond to poptorootviewcontrolleranimated: method. */        if([Viewcontroller Iskindofclass:[uinavigationcontrollerclass]]) {[(Uinavigationcontroller*) Viewcontroller Poptorootviewcontrolleranimated:yes]; }

iOS basic notes (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.