UIApplication of Multi-controller

Source: Internet
Author: User

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
    • The app is disturbed to produce a series of trivia, when UIApplication notifies its proxy object to handle
    • Handling Events:

      // 应用程序启动完成的时候调用- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {return YES;}// 当应用程序即将失去焦点(不可与用户交互)- (void)applicationWillResignActive:(UIApplication *)application {}// 应用程序进入后台- (void)applicationDidEnterBackground:(UIApplication *)application {}// 应用程序将要进入前台- (void)applicationWillEnterForeground:(UIApplication *)application {}// 应用程序完全获得焦点(可与用户交互)- (void)applicationDidBecomeActive:(UIApplication *)application {}// 程序即将关闭的时候- (void)applicationWillTerminate:(UIApplication *)application {}
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.