简体   繁体   中英

iPad statusBar orientation lock (landscape/portrait only)

I've been working on a Landscape only iPad app (which is allowed if you support both right and left landscape modes). The views are properly set-up, but the status bar is buggy. The iPad's status bar auto-rotates on it's own, and I couldn't find anything that can override it. The status bar supports all orientations regardless of what is found in the info.plist (Supported orientations and initial orientation).

I have found a workaround, by running a timer in the UIApplicationDelegate and forcing the orientation on the status bar every time, but that's just ugly and 'causes the bar to be jumpy.

Any way to lock the iPad's status bar to support only landscape (right and left)?

Thanks in advance, ~ Natanavra.

Some of your code would help, but this is what I usually use in my ViewController:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
  return (interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}

Which locks to landscape (both sides). I've never had any problems with the Status Bar, but I usually hide it.

Also, on the .plist I only have 2 supported interface orientations: item0 = Landscape (Right home button) item1 = Landscape (Left home button)

Hope this helps :)

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