开发者

iPad statusBar orientation lock (landscape/portrait only)

开发者 https://www.devze.com 2023-01-25 03:53 出处:网络
I\'ve been working on a Landscape only iPad app (which is allowed if you support both right and left landscape modes).

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 j开发者_如何学Goust 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 :)

0

精彩评论

暂无评论...
验证码 换一张
取 消