有两种方法:
1、通过AppDelegate来判断;
2、在基类中创建NSNotification
- (void)viewDidLoad
{
[super viewDidLoad];
// 注册通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hello) name:UIApplicationDidBecomeActiveNotification object:nil];
}
- (void)hello
{
// todo
}