When my app stars in landscape mode, a black bar (the same size and position as the dock) appears and my app gets cut and it never goes away when i rotate the device. It worked fine in iOS 6 and i can't find any solution.
Asked
Active
Viewed 1,140 times
2
-
2can you attach a screen shot? – apollosoftware.org Sep 20 '13 at 14:11
2 Answers
0
For apps with screen rotation,
use NSNotificationCenter to detect orientation changes by adding
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationDidChangeStatusBarOrientation:)
name:UIApplicationDidChangeStatusBarOrientationNotification
object:nil];
in if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
and create a new method
- (void)applicationDidChangeStatusBarOrientation:(NSNotification *)notification;
{
int a = [[notification.userInfo objectForKey: UIApplicationStatusBarOrientationUserInfoKey] intValue];
int w = [[UIScreen mainScreen] bounds].size.width;
int h = [[UIScreen mainScreen] bounds].size.height;
switch(a){
case 4:
self.window.frame = CGRectMake(0,20,w,h);
break;
case 3:
self.window.frame = CGRectMake(-20,0,w-20,h+20);
break;
case 2:
self.window.frame = CGRectMake(0,-20,w,h);
break;
case 1:
self.window.frame = CGRectMake(20,0,w-20,h+20);
}
}
in AppDelegate
so that when orientation changes, it will trigger a switch statement to detect app's screen orientation (Portrait, Upside Down, Landscape Left, or Landscape Right) and change app's window frame respectively to create the iOS 6 status bar illusion.
This is referenced @ iOS 7 status bar back to iOS 6 default style in iPhone app?
Alternatively:
If you are using Storyboards (iOS 5+) and don't want your view controllers to be overlapped by the status bar (and navigation bars), deselect the "Extend Edges Under Top Bars" box in Xcode 5.0 IB Storyboard.

Community
- 1
- 1

apollosoftware.org
- 12,161
- 4
- 48
- 69
-
thanks but a found a a simpler way. Just needed to readjust de resizing masks. ;) – Gaspar Oliveira Sep 24 '13 at 11:51
-2
Just needed to readjust de resizing masks.

Gaspar Oliveira
- 79
- 4
-
-
"readjust de resizing masks" isn't helpful; we don't know what that means. – Adam Wilt Nov 08 '14 at 04:01