UIApplication Introduction
- UIApplication objects are symbols of the application
- Each application has its own UIApplication object, which is a singleton object that can be
[UIApplication sharedApplication]
obtained and cannot be created with Alloc
- The first object created after a program is started is a UIApplication object
- With this object, you can do an application-level operation:
- Displays the red reminder number in the upper-right corner of the program icon (iOS8 to register for notification):
applicationIconBadgeNumber(属性)
- Display the visibility of the networking indicator (IOS7 to controller management, so set):
statusBarHidden(属性)
- Call:
openURL(方法)
- Texting:
openURL(方法)
- Browse the Web:
openURL(方法)
- Wait a minute
- Note: The Load class method (Cannot access property): Called when the class is loaded into memory, it is earlier than the Main method call
Agent Delegate
How the application starts
int main(int argc, char * argv[]) { @autoreleasepool { // 第三个参数:设置UIApplication的对象的名称,只能它或者它子类,nil == @"UIApplication" // 第四个参数:创建代理对象,遵守了UIApplicationDelegate协议,把这个对象设为应用程序(UIApplication)的代理 // 用NSStringFromClass:将一个类名转换成字符串---1.提示功能 2.避免输入错误 return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); }}
// 程序的启动原理// 1.执行main -> UIApplicationMain// 2.创建UIApplication对象,并设置它的代理// 3.开启了一个事件循环(主运行循环)(死循环) -> 保证应用程序能一直运行// 4.应用程序加载Info.plist配置文件,判断该文件中是否有main值,如果有就会去加载Main.storyBoard, 如果没有就执行didFinishLaunchingWithOptions:方法,应用程序启动完毕
UIApplication of Multi-controller