How can I determine what controller/window is currently in the applicationDidBecomeActive? For example on the login screen (which is a LoginViewController), if the applicationDidBecomeActive fires how do I know it is the login screen from the appDelegate?
The UIApplication object passed to applicationDidBecomeActive has a windows property. It is an NSArray of visible windows, ordered back to front.
Once you have the foreground window, you can get the first subview and test its type:
if ([[foregroundWindow.subviews objectAtIndex:0] class] == [LoginViewController.view class]) {
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With