Onk*_*arK 3 iphone uiinterfaceorientation ios ios7
在我的应用程序中,支持的方向是Landscape Right和Landscape Left.它的单屏应用程序.在ViewController中,我添加了以下代码来限制方向.
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
-(BOOL)shouldAutorotate
{
return YES;
}
Run Code Online (Sandbox Code Playgroud)
我的问题是每当应用程序在Landscape Left中启动时.如果设备位置右侧,则应用视图旋转180度,然后应用程序开始在右侧右侧工作.
如果设备位置是横向左侧,则没有问题.
注意:我正在测试iPod 5上的应用程序.
编辑:
经过一些观察,如果你只支持风景(即风景右侧和风景左),那么你将面临这个问题.应用程序将始终以plist中首先列出的方向打开(在我的情况下是Landscape Left).
我通过删除Landscape Left方向支持来解决此问题.如果有人有解决方案,请分享.
感谢帮助.
小智 5
我有同样的问题,在plist中设置'初始界面方向'到UIInterfaceOrientationLandscapeLeft不起作用,也没有在视图控制器中的preferredInterfaceOrientationForPresentation中返回它.
为我解决这个问题的方法是重新排序plist中的"Supported interface orientation"数组,使我想要的初始方向作为数组中的第一项.
归档时间: |
|
查看次数: |
1304 次 |
最近记录: |