Title23

Title23

AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    return YES;
}

AppDelegate.h/m define a class that manages the application overall.
AppDelegate.h/m 定義了一個類別可以管理整個應用程式

The app will create one instance of that class and send that object messages that let the delegate influence the app’s behavior at well-defined times. For example,
這個應用程式會創造一個實體給類別去傳送物件訊息
讓代理影響明確定義到所有的應用程式行為
例如:
-application:didFinishLaunchingWithOptions:
is sent when the app has finished launching and is ready to do something interesting.
當應用程序已經完成啟動,並準備做一些有趣的事情被發送。

Take a look at the UIApplicationDelegate reference page for a list of messages that the app delegate can implement to modify the behavior of the application.

看看在UIApplicationDelegate參考頁的應用程序委託可以實現修改應用程序的行為信息的列表。

相當於Asp.Net 中的 Global.ascx ,做全域變數的控制。


AppDelegate.h/m 中內建的方法:

  1. application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

Tells the delegate when the application has launched and may have additional launch options to handle.

在应用程序启动后,要执行的委托调用。

  1. applicationWillResignActive:(UIApplication *)application

Tells the delegate that the application is about to become inactive.This method is called to let your application know that it is about to move from the active to inactive state.After calling this method, the application also posts a UIApplicationWillResignActiveNotification notification to give interested objects a chance to respond to the transition.

在应用程序将要由活动状态切换到非活动状态时候,要执行的委托调用,如 按下 home 按钮,返回主屏幕,或全屏之间切换应用程序等。

  1. applicationDidEnterBackground:(UIApplication *)application

Tells the delegate that the application is now in the background.Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.

在应用程序已进入后台程序时,要执行的委托调用。

  1. applicationWillEnterForeground:(UIApplication *)application

Tells the delegate that the application is about to enter the foreground.Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.

在应用程序将要进入前台时(被激活),要执行的委托调用,刚好与 applicationWillResignActive 方法相对应。

  1. applicationDidBecomeActive:(UIApplication *)application

Tells the delegate that the application has become active.Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

在应用程序已被激活后,要执行的委托调用,刚好与 applicationDidEnterBackground 方法相对应。

  1. applicationWillTerminate:(UIApplication *)application

Tells the delegate when the application is about to terminate.Called when the application is about to terminate. Save data if appropriate.

在应用程序要完全推出的时候,要执行的委托调用。

Comments

Popular posts from this blog

MEGA 暫存檔案刪除

IOS GCD多執行緒

利用CMD指令強制刪除