iOS之捕捉home事件

来源:互联网 发布:网红脸是什么体验知乎 编辑:程序博客网 时间:2024/05/16 09:51

有两种方法:

1、通过AppDelegate来判断;


2、在基类中创建NSNotification

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


0 0
原创粉丝点击