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)