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

2010年9月2日木曜日 | Published in | 0 コメント

このエントリーをはてなブックマークに追加

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

Responses

Leave a Response

人気の投稿(過去 30日間)