1 //2 //VIEWCONTROLLER.M3 //GCC4 //5 //Created by admin on 15/10/7.6 //copyright©2015 Year Admin. All rights reserved.7 //8 9 #import "ViewController.h"Ten One @interfaceViewcontroller () A -@property (nonatomic, Strong) uibutton*btn; - the@property (nonatomic, Strong) uibutton*BlueButton; - - @end - + @implementationViewcontroller - +- (void) Viewdidload A { at [Super Viewdidload]; - -uibutton* btn = [[UIButton alloc] Initwithframe:cgrectmake ( -, -, -, -)]; -Btn.backgroundcolor =[Uicolor Redcolor]; - - [Self.view addsubview:btn]; in [Self.view addSubview:self.btn]; - [Self.view AddSubview:self.blueButton]; to } + - ///GCC the-(uibutton*) BlueButton * { $ if(!_bluebutton) {Panax Notoginseng -_bluebutton = ({ theuibutton* BTN =[[UIButton alloc] initWithFrame: ({ +CGRect frame = CGRectMake ( -, -, -, -); A frame; the })]; +Btn.backgroundcolor =[Uicolor Bluecolor]; - btn; $ }); $ } - return_bluebutton; - } the - ///lazy way to loadWuyi-(uibutton*) btn the { - if(_btn = =Nil) { Wu_BTN = [[UIButton alloc] Initwithframe:cgrectmake ( -, $, -, -)]; -_btn.backgroundcolor =[Uicolor Greencolor]; About } $ - return_btn; - } - A @end
"iOS Development" Add child control mode (lazy loading, GCC)