2013-08-19 32 views
0

我說通知我的UIViewController捕NSNotification停止顯示控制器presentViewController

- (void)applicationWillResignActive:(UIApplication *)application: 

這樣

- (void)viewDidLoad { 

      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActive:) 
               name:APP_RESIGN_ACTIVE_NOTIFICATION object:nil]; 

它好的工作後的工作,但如果我告訴其他的控制器是這樣的:

[self presentViewController:[[UINavigationController alloc] initWithRootViewController:view] 
        animated:YES 
       completion:nil]; 

通知停止工作。 我刪除通知只有在

- (void)viewDidUnload { 

    [super viewDidUnload]; 

    [[NSNotificationCenter defaultCenter] removeObserver:self name:APP_RESIGN_ACTIVE_NOTIFICATION object:nil]; 

但是當我告訴模態控制器那就不叫。

回答

4

對不起,我在基類中找到了一個地方,我刪除了通知。

+1

我有同樣的問題:基類刪除所有通知...感謝分享你的發現 - 它爲我節省了很多時間! – Joshua

+1

謝謝!做了同樣的事情。 – kleezy