关于UIApplicationMain

 The main.m File and the UIApplicationMain Function

The main function in main.m calls the UIApplicationMain function within an autorelease pool.

@autoreleasepool {
   return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
The @autoreleasepool statement supports memory management for your app. Automatic Reference Counting (ARC) makes memory management straightforward by getting the compiler to keep track of who owns an object; @autoreleasepool is part of the memory management infrastructure.

The call to UIApplicationMain creates two important initial components of your app:

An instance of the UIApplication class, called the application object.
The application object manages the app event loop and coordinates other high-level app behaviors. The UIApplication class, defined in the UIKit framework, doesn’t require you to write any additional code to get it to do its job.
An instance of the AppDelegate class, called the app delegate.
Xcode created this class for you as part of setting up the Single View Application template. The app delegate creates the window where your app’s content is drawn and provides a place to respond to state transitions within the app. The app delegate is where you write your custom app-level code. Like all classes, the AppDelegate class is defined in two source code files in your app: in the interface file, AppDelegate.h, and in the implementation file, AppDelegate.m.
As your app starts up, the application object calls predefined methods on the app delegate to give your custom code a chance to do its job—that’s when the interesting behavior for an app is executed. 

转载于:https://www.cnblogs.com/footy/p/4653219.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值