将nsnotification发送到非活动viewcontroller时会发生什么?

时间:2012-08-11 05:21:58

标签: objective-c ios nsnotificationcenter

在我的applicationWillEnterForeground中,如果需要更新数据,我会检查并发送通知:

[[NSNotificationCenter defaultCenter] postNotificationName:@"refreshModelNotification" object:nil];

该特定通知的唯一观察者是特定的视图控制器:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshData:) name:@"refreshModelNotification" object:nil];

该视图控制器是UITabBarController内的几个视图控制器之一。

我的问题是:如果在发送通知时该视图控制器不是活动标签会发生什么?

提前致谢。

1 个答案:

答案 0 :(得分:1)

如果观察者仍然为视图控制器设置,则视图控制器仍将接收通知并且正常运行,除非视图控制器视图的任何视觉更改都不会被看到