0

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,

enter image description here

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

Ramesh Sangili
  • 1,633
  • 3
  • 17
  • 31
  • how does it look on _real_ device? – holex Mar 07 '14 at 23:21
  • same behavior. Status bar shows on Portrait mode, but the view is in Landscape mode. – Ramesh Sangili Mar 09 '14 at 05:51
  • how did you set up the `rootViewController` property of the `UIWindow`? – holex Mar 09 '14 at 09:08
  • I think you have no clue what I'm talking about, don't you...? – holex Mar 10 '14 at 08:52
  • Sorry, I am not sure what exactly you are looking for? I am new to iOS development and working on the upgrade issues from iOS6 to 7 – Ramesh Sangili Mar 10 '14 at 14:15
  • We are building this application on top of a framework, so not pretty sure how they do. We import the library for the framework and built our screens on top of that. – Ramesh Sangili Mar 10 '14 at 14:36
  • try to find out the answer to my question because that issue happens when the view hierarchy is broken and the broken hierarchy cannot support different orientations. the most common breakpoint is when any of the `UIViewController` objects is not part of the standard navigation stack anymore, and in that case the navigation controllers must handled manually. the most common place where the developers break the view hierarchy is the `rootViewController`. as usual they have no idea where and what they have broken, so they cannot solve the issue, of course, but that info is a good start for you. – holex Mar 10 '14 at 17:38

2 Answers2

0

change this method

- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscapeRight;

}

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

0

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];

}
Ramesh Sangili
  • 1,633
  • 3
  • 17
  • 31