This is my issue....
This happens when:
- Status bar is faded out using the button.
- Rotate 180 deg from landscape to upside-down landscape.
- Status bar is faded back in using the button. - it now covers the navigation bar.
The button code to toggle the status bar visibility:
- (IBAction)toggleBar:(id)sender
{
NSLog(@"View Frame : %@", NSStringFromCGRect(self.view.frame));
// Toggle status bar visiblity
BOOL isStatusBarHidden = [[UIApplication sharedApplication] isStatusBarHidden];
[[UIApplication sharedApplication] setStatusBarHidden:!isStatusBarHidden
withAnimation:UIStatusBarAnimationFade];
}
The view always reports its frame to be 480 x 288.
The issue was fixable on iOS 5 using a hacky workaround, by stopping the rotation filling the space.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ([[UIApplication sharedApplication] isStatusBarHidden])
{
float oldAlpha = self.navigationController.navigationBar.alpha;
self.navigationController.navigationBar.alpha = 0.01;
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
double delayInSeconds = 0.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
self.navigationController.navigationBar.alpha = oldAlpha;
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
});
}
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
This dons't work on iOS 6 because shouldAutorotateToInterfaceOrientation
is not called. However, using its replacement: willRotateToInterfaceOrientation
also dosn't work. Any ideas?