Closed krasnyk closed 12 years ago
Yep, on an iPad there's a 50% chance the status bar overlay will appear in the incorrect device orientation. I've also seen it where the bar is horizontal, but the text messages partially appear vertical within it (only 2 or 3 characters will show, vertically).
Unfortunately, I can't get this to reproduce on the simulator and it seems to happen sporadically on the device. I wonder if this has to do with it being face-up (makes it difficult to determine proper orientation?)
Can't use this nifty tool in the iPad version of my app due to this issue.
If it is launched in LandscapeLeft, not only will the status bar overly not work as intended, but any posted messages will black out the entire screen with a super large progress indicator on the sim and device w/iOS 4.3.
The fix for me was to move the first call that instantiates the MTStatusBarOverlay until after my view controllers are up and running in the UIWindow. ... If you instantiate the statusBarOverlay too soon, it basically get's tangled up in UIWindow's weird-ass orientation conversions ... UIWindow actually runs and draws everything assuming it's in portrait, even on the iPad ... it then transforms the orientation and drawing for the view controllers that attach to it, making them appear to be the correct side up, even though it's still handling it's own business in portrait only.... good times.
Ya, this is a big issue. I delay mine right up until needed in my app and it still turns out horrible when the app is launched in landscape.
After trying to solve this the right way all day, I finally settled on just a hack that seems to work. If you forcefully set the orientation to portrait before the MTStatusBarOverlay initWithFrame:
call, then set it back after it works.
- (id)initWithFrame:(CGRect)frame {
UIInterfaceOrientation orient = [[UIApplication sharedApplication] statusBarOrientation];
if ((self = [super initWithFrame:frame])) {
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
…
…
…
[[UIApplication sharedApplication] setStatusBarOrientation:orient animated:NO];
}
return self;
}
There is no visual glitch of the status bar or anything, but it still feels wrong.
This issue was finally fixed in f908a89c5f7108327120c103ee1ee09abc67a4b9, thank to @gekitz !
Take StatusOverlay version from b2969135c24965a25da921ede03c84e176c842db or download sample project from: http://www.DropBox.pl/file.php?name=217657578780A35E905C5FACEC9C80B7
Steps to reproduce:
I guess the following is also connected with the above one: