In an iOS program, an app defaults to only one uiwindow. UIWindow is a special UIView control and the first UIView object created after the program starts, in order to understand the relationship between UIWindow and Uiviewcontroller, and the creation of Uiviewcontroller, Start with a new Emptyapplication project.
Empty project, the default directory structure only Appdelegate class, this class is the delegate of the Application object, will be in the different life cycle of the program callback different methods (about the application life cycle of the topic, and so I learned good in hooves ... The code in Didfinishlaunchingwithoptions is as follows
?
| 1 2 3 4 5 |
self.window = [[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];      //Override point for customization after application launch.      self.window.backgroundcolor = [Uicolor whitecolor];      [self.window makekeyandvisible];      return yes; |
You can see that the program is started, the Appdelegate object creates a UIWindow object, sets the background color of the window to white, and then makes it visible through makekeyandvisible and becomes the main window, and runs directly to see a white area unfold in front of you. All UI elements on the interface, if you want to show it, must rely on the UIWindow object, without specifying UIWindow's UIView, it will automatically generate a UIView object. Creating Uiviewcontroller is roughly custom created directly, created through storyboard, and created using xib files.
(not to be continued ...) )