2010年9月2日木曜日

UIApplicationDelegate のマルチタスキング関連メソッド調査 [3] Notification

Notification についてもざっと確認した(マルチアプリのみ)。
Loading…

結果は UIApplicationDelegate と同じ。
(それだけ)


以下、検証コード抜粋。

application:didFinishLaunchingWithOptions: にて NSNotificationCenterへ登録。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    
    // Override point for customization after application launch.
 NSNotificationCenter* center = [NSNotificationCenter defaultCenter];

 [center addObserver:self
      selector:@selector(recievedNotification:)
       name:UIApplicationDidBecomeActiveNotification
     object:nil];
 
 [center addObserver:self
      selector:@selector(recievedNotification:)
       name:UIApplicationDidEnterBackgroundNotification
     object:nil];
 
 [center addObserver:self
      selector:@selector(recievedNotification:)
       name:UIApplicationDidReceiveMemoryWarningNotification
     object:nil];
 
 [center addObserver:self
      selector:@selector(recievedNotification:)
       name:UIApplicationWillEnterForegroundNotification
     object:nil];

 [center addObserver:self
      selector:@selector(recievedNotification:)
       name:UIApplicationWillResignActiveNotification
     object:nil];
 
 [center addObserver:self
      selector:@selector(recievedNotification:)
       name:UIApplicationWillTerminateNotification
     object:nil];
        :

-(void)recievedNotification:(NSNotification*)notification
{
 NSLog(@"%@", notification.name);
}


GitHub
UIApplicationNotification at 2010-09-02 from xcatsan's iOS-Sample-Code - GitHub

0 件のコメント:

コメントを投稿