Appdelegate.m
-(void) dealloc{[_window release]; [Super Dealloc];} -(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions{self. window = [[UIWindow alloc] Initwithframe:cgrectmake (0, 0, 320, 480)]; Self.window.backgroundColor = [Uicolor Redcolor]; /* Makekeyandvisible's role: 1. Let window display directly on the screen, this is the Window property, view does not have this property, if the room view, need to add to the other view on the display 2. Set the current window as the main window */ [_window makekeyandvisible]; _window.windowlevel = Uiwindowlevelstatusbar; UIWindow *w2 = [[UIWindow alloc] Initwithframe:cgrectmake (0, 0, 90, 90)]; W2.backgroundcolor = [Uicolor greencolor];//[W2 makekeyandvisible]; I can't write this.//hidden: W2 is displayed on the main window, but W2 is not the main window W2.hidden = no; /* Set window Priority: Uiwindowlevelnormal < Uiwindowlevelstatusbar < Uiwindowlevelalert; The default is: Uiwindowlevelnormal */w2.windowlevel = Uiwindowlevelalert; Get the main window of the current program UIWindow *W3 = Application.keywindow; NSLog (@ "Self.window:%@ ", Self.window); NSLog (@ "w3:%@", W3); return YES;}
Program Entry and Appdelegate window display principle