iOS之捕捉home事件

有两种方法:

1、通过AppDelegate来判断;


2、在基类中创建NSNotification

- (void)viewDidLoad
{
    [super viewDidLoad];
    // 注册通知
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hello) name:UIApplicationDidBecomeActiveNotification object:nil];
}
- (void)hello
{
    // todo
}


你可能感兴趣的:(iOS之捕捉home事件)