As per this link Each object receive a UIApplicationDidEnterBackgroundNotification
notification when the app goes in background. Similarly UIApplicationWillEnterForegroundNotification
gets fired when app comes in foreground.
so you can use it to keep track of which view controller is opened when app enters foreground
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(appEnteredForeground:)
name:UIApplicationDidEnterForegroundNotification
object:nil];