I have a tabbar application with a bit of a bug.
When the application goes inactive we need to move to the first tab. so we have this in the app delegate:
Code:
- (void)applicationWillResignActive:(UIApplication *)application {
[self.tabBarController setSelectedIndex:0];
}
On one of the tabs we allow the device to change orientation to landscape. If the application is in landscape and the user presses either the home button or the power button this method is called and it seems to also call the
Code:
- (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
In the tab that is in landscape. The view gets corrected and everything is fine.
If however the user just puts down the application while in landscape mode the UI isn't corrected.
The applicationWillResignActive method IS called and it is selecting the first tab. I have added logging to the willAnimateRotationToInterfaceOrientation method as well and this is a bit strange. When I press the home button or exit button although the code in the willAnimateRotationToInterfaceOrientation seems to run there is no logging.
I am logging 'self' in viewdidappear and it IS the same object I am loading so I'm not loading a fewsh new screen or anything.
Back to my question I suppose - I guess I shouldn't be trying to update the UI in the applicationWillResignActive method - is there anything called before that perhaps I could call to sort out the UI before the app goes to sleep?