简体   繁体   中英

iOS 7 Status bar issues on Landscape mode

I have a signature screen in my application that is suppose to show in Landscape, but the iPhone status bar displays in Portrait mode. How to get the Status bar to show in Landscape mode instead of portrait mode? I tried setting the Landscape orientation to status bar in ViewDidLoad, but no luck..

I use presentViewController to push screen,

在此处输入图片说明

Please find the below snippet of code to push the screen to Landscape mode.

// Override to allow orientations other than the default Landscape orientation.
- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;
}


- (BOOL) shouldAutorotate {
    return YES;
}


- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationLandscapeRight;
}

Any help is greatly appreciated!

Thanks, Ramesh

change this method

- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscapeRight;

}

and also this properties: In your project -> General -> Device Orientation, check Portrait and Landscape Right.

Resolved by adding the following methods,

- (void)viewWillAppear:(BOOL)animated {
    [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
}

- (void)viewWillDisappear:(BOOL)animated {
    [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM