Four main objects:
2.UIApplication:
1. Introduction
1> A symbol of the entire application, an application on a UIApplication object, using a singleton design pattern
2> access to this singleton object via [UIApplication sharedapplication]
2. Common usage
1> set icon in the upper right corner of the red hint number
App.applicationiconbadgenumber = 10;
2> Setting the style of the status bar
App.statusbarstyle = Uistatusbarstyleblackopaque;
3> Control the display and hiding of the status bar
App.statusbarhidden = YES;
4> Show the circle above the status bar
app.networkactivityindicatorvisible = YES;
5> Open External resources
Open Web page
[App Openurl:[nsurl urlwithstring:@ "http://www.baidu.com"];
Call
[App Openurl:[nsurl urlwithstring:@ "tel://10086"];
Texting
[App Openurl:[nsurl urlwithstring:@ "sms://10086"];
6> Agent Properties (when the application has some system-level events, the agent is notified and sent to the agent for processing)
@property (nonatomic,assign) ID delegate;
Proxy methods for Uiapplicationdelegate
The pragma mark program is loaded (boot complete) and is called once
- (BOOL) Application: (uiapplication) Application didfinishlaunchingwithoptions: (nsdictionary) launchOptions
pragma mark when the application loses focus (an app cannot interact with the user if it loses focus)
- (void) Applicationwillresignactive: (uiapplication *) application
The pragma mark program enters the background and calls
- (void) Applicationdidenterbackground: (uiapplication *) application
Pragma mark program is about to enter the foreground when the call
- (void) Applicationwillenterforeground: (uiapplication *) application
Called when the pragma mark application gets focus (an app can interact with the user only after the focus has been focused)
- (void) Applicationdidbecomeactive: (uiapplication *) application
pragma mark program may be called when it is about to be closed
- (void) Applicationwillterminate: (uiapplication *) application
The pragma mark program receives a memory warning called
- (void) Applicationdidreceivememorywarning: (uiapplication *) application
3.UIWindow:
3.1 Basic knowledge:
UIWindow is a special kind of uiview that usually has only one uiwindow in an app .
after the iOS program starts, the first view control created is UIWindow, then the controller's view is created, the controller's view is added to the UIWindow, and the controller's view is displayed on the screen.
an iOS program can be displayed on the screen entirely because it has uiwindow
It says that without UIWindow, you can't see any UI interface.
3.2 UIWindow's acquisition:
[UIApplication sharedapplication].windows
A list of UIWindow that opens in this app so you can touch any of the UIView objects in your app
(usually input text pop-up keyboard, in a new UIWindow)
[UIApplication Sharedapplication].keywindow
The UIWindow used to receive message events for keyboards and non-touch classes , and only one uiwindow per time in a program is Keywindow. If a text box inside a UIWindow cannot enter text, it may be because this uiwindow is not Keywindow
View.window
Get the UIWindow where a uiview is located
2016-1-4 project Start-up principle