【发布时间】:2015-02-12 16:43:55
【问题描述】:
当我的应用程序进入前台时,我需要从应用程序委托类调用我的视图控制器的一些方法。最好的实现方式是什么?
我尝试在“applicationWillEnterForeground”方法中创建“假”通知:
[NSNotificationCenter defaultCenter]postNotificationName:@"test" object:nil];
并在视图控制器中添加观察者:
[self addObserver: self selector:@selector(testMethod) name:@"test" object:nil];
这样好吗?那里的另一种方法:Calling UIViewController method from app delegate
哪种方法更好,为什么?
PS 对不起,我的英语不好。
【问题讨论】: