質問

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.

役に立ちましたか?

解決 2

Just needed to readjust de resizing masks.

他のヒント

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.

uncheck the Extend Edges Under Top Bars

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top