Search code examples
objective-cios9

Handle top left button on iOS9


I have an application, and this application open an url in Safari. But if the user tap on the top left button to return to my app how can i catch this event?


Solution

  • For this case, the solution is to view controller register for the UIApplicationWillEnterForegroundNotification notification. When this notification is sent, you can do the stuff needed.

        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(doSomeStuff) name:UIApplicationWillEnterForegroundNotification object:nil];
    
       -(void)doSomeStuff
        {
        //handle what you needed
        }