问题描述
我有使用横向正确方向的应用程序。
在视图控制器中我使用:
I have application that uses landscape right orientation.In view controllers I use:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
但是,如果用户锁定 iphone或ipad到人像方向,屏幕显示
为肖像,而非横向。另外,在info.plist文件中,我只定义了右侧景观方向,因为
支持一个。
But, If user locks iphone or ipad to portrait orientation, screen is displayedas portrait, not landscape. Also, in info.plist file I defined only Right Landscape orientation assupported one.
推荐答案
问题出在函数viewDidLoad中,其中另一个视图控制器立即被推入导航堆栈。如果推动动作延迟,则横向旋转将开始并继续,并且所需的视图控制器将以横向方向正确推动。
The problem was in function viewDidLoad where another view controller is pushed into navigation stack immediately. If pushing action is delayed then landscape rotation will start and proceed, and also desired view controller will be pushed properly with landscape orientation.
这篇关于仅支持横向界面方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!