我想知道在NSNotificationCenter defaultCenter中調用viewWillAppear:
方法是否好。很好的調用選擇器方法ViewWillAppear在NSNotificationCenter
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(viewWillAppear:) name:UIApplicationDidBecomeActiveNotification object:nil];
或者
-(void)setUpInitialization{
// dump code here in ViewWillAppears.
}
調用方法setUpInitialization
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(setUpInitialization) name:UIApplicationDidBecomeActiveNotification object:nil];
如果直接調用viewWillAppear
是實現一個沒有好辦法?
當應用程序變爲活動狀態時,系統是否已經調用了「viewWillAppear:'? – mattsson
@mattsson是的,應用程序變成活動的tabbarcontroller。 – kiran
那麼爲什麼使用通知再次調用它? – mattsson