If the application was previously in the background, when applicationDidBecomeActive is called,how can I optionally refresh the user interface ?
I expect the current view controller is always the initial view controller in storyboard.I can’t get the pointer to storyboard in my main AppDelegate.m .
How can I check and determine which view controller is currently showing ?
If you just want a pointer to your storyboard then you can do this:
where
rootViewControlleris actually the initial view controller of your storyboard. If you expect this controller to be the current controller (as you say) then you’re good to go, but if you want to actually update your UI, then I guess you could post a custom notification from the delegate (insideapplicationDidBecomeActive), and register each controller that may be interested to catch it so it can update its UI (or just addselfas observer forUIApplicationDidBecomeActiveNotificationto catch the same one that your delegate catches…).PS. If your
rootViewControlleris aUINavigationControlleryou can get the currently showing controller like this: