1 #import "TestDicAppDelegate.h"2 3 @implementationtestdicappdelegate4 5-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) Launchoptions6 {7 //produces a Window object that makes it the same size as the screen. 8Self.window =[[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds];9 //Override point for customization after application launch.TenSelf.window.backgroundColor =[Uicolor Blackcolor]; One //sets the Window object as the primary window and is visible. A [Self.window makekeyandvisible]; - - the //1. Create a UIView object: - //2.UIView determines the position size by cgrect the structure body. -UIView *view9 = [[UIView alloc] initWithFrame: (CGRectMake ( Max,Ten, $, the))]; - [View9 setbackgroundcolor:[uicolor darkgraycolor]; + [Self.window addsubview:view9]; - +UIView *view8 = [[UIView alloc] initWithFrame: (CGRectMake ( the, -, the,405))]; A [View8 setbackgroundcolor:[uicolor orangecolor]; atView8.alpha =0.9;//Transparency -View8.hidden = NO;//Hidden - -View8.tag =10000;//set the tag value of the view (function: Convenient parent view Quick seat view) - - [Self.window addsubview:view8]; inNSLog (@"%@", View8.superview); - to //Find a child view by tag + //UIView *viewtemp = [Self.window viewwithtag:10000]; - the *UIView *view7 = [[UIView alloc] initWithFrame: (CGRectMake ( the, +, the,355))]; $ [View7 setbackgroundcolor:[uicolor purplecolor];Panax Notoginseng [Self.window addsubview:view7]; - theUIView *view6 = [[UIView alloc] initWithFrame: (CGRectMake ( -, -, the,305))]; + [View6 setbackgroundcolor:[uicolor browncolor]; A [Self.window addsubview:view6]; the +UIView *VIEW3 = [[UIView alloc] initWithFrame: (CGRectMake ( -, the, the,255))]; - [view3 setbackgroundcolor:[uicolor bluecolor]; $ [Self.window addsubview:view3]; $ -UIView *view = [[UIView alloc] Initwithframe:cgrectmake ( -, -, Max,205)]; - [view Setbackgroundcolor:[uicolor Yellowcolor]; the - //3. Add the View object to the windowWuyi [Self.window Addsubview:view]; the - WuUIView *view1 = [[UIView alloc] initWithFrame: (CGRectMake ( -, -, $,155))]; - [View1 setbackgroundcolor:[uicolor greencolor]; About [Self.window Addsubview:view1]; $ -UIView *view2 = [[UIView alloc] initWithFrame: (CGRectMake (Ten, $, the, the))]; - [View2 Setbackgroundcolor:[uicolor redcolor]; - [Self.window addsubview:view2]; A +UIView *view4 = [[UIView alloc] initWithFrame: (CGRectMake (-Ten, the, -, -))]; the [View4 setbackgroundcolor:[uicolor cyancolor]; - [Self.window addsubview:view4]; $ theUIView *view5 = [[UIView alloc] initWithFrame: (CGRectMake ( -, the, -, the))]; the [view5 setbackgroundcolor:[uicolor magentacolor]; theView5.alpha =0.5; the [Self.window addsubview:view5]; - in //Change the center point the //view3.center = cgpointmake (0, 0); the About //4. Memory management (release) the [view release]; the returnYES; the } + -- (void) Applicationwillresignactive: (UIApplication *) Application the {Bayi //Sent when the application are about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as a incoming phone call or SMS message) or when the US Er quits the application and it begins the transition to the background state. the //Use the This method to the pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. the } - -- (void) Applicationdidenterbackground: (UIApplication *) Application the { the //Use the method to release the shared resources, save user data, invalidate timers, and store enough application state in Formation to the restore your application to the it is terminated later. the //If Your application supports background execution, this method is called instead of Applicationwillterminate:when th E user quits. the } - the- (void) Applicationwillenterforeground: (UIApplication *) Application the { the //Called as part of the transition from the background to the inactive state; Here you can undo many of the changes Ma De on entering the background.94 } the the- (void) Applicationdidbecomeactive: (UIApplication *) Application the {98 //Restart Any tasks this were paused (or not yet started) while the application is inactive. If the application is previously in the background, optionally refresh the user interface. About } - 101- (void) Applicationwillterminate: (UIApplication *) Application102 {103 //Called when the application are about to terminate. Save data if appropriate. See also Applicationdidenterbackground:.104 } the 106 @end
UI creation in view view