2013-08-19 28 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