处理 iOS9 上的左上角按钮

Handle top left button on iOS9

我有一个应用程序,这个应用程序在 Safari 中打开了一个 url。但是,如果用户点击左上角的按钮 return 到我的应用程序,我该如何捕捉此事件?

对于这种情况,解决方案是查看控制器注册 UIApplicationWillEnterForegroundNotification 通知。发送此通知后,您可以执行所需的操作。

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(doSomeStuff) name:UIApplicationWillEnterForegroundNotification object:nil];

   -(void)doSomeStuff
    {
    //handle what you needed
    }