开发者

Locking app in landscape mode only

In my app I have the condition of launching my app only in Landscape mode .so for that in will rotate to interface orientation i have done this way:-

return (interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft);

But then also my app tries to load in Portrait mode first and in the procedure the screen looks stretching. Am I missing something? Please sugge开发者_Go百科st. Any help will be appreciated

Thanks,

Christy


You say the code above is in -(void)willRotateToOrientation when it should be placed in -(BOOL)shouldRotateToOrientation.

Assuming that is a typo, set the supported orientations in the Info.plist file to LandscapeRight and LandscapeLeft.


Just to make sure Christina's fix in the comments to the other answer doesn't go missed:

application.statusBarOrientation = UIInterfaceOrientationLandscapeRight

I added this in the didFinishLaunching app delegate function and it seems to force a view controller refresh which in my case ensured the OpenGL frame buffer was created in the correct dimensions, bizarre that I have to add this though.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜