仅支持横向界面方向 [英] Only support for landscape Interface orientation

查看:114
本文介绍了仅支持横向界面方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有使用横向正确方向的应用程序。
在视图控制器中我使用:

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 displayed as portrait, not landscape. Also, in info.plist file I defined only Right Landscape orientation as supported 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.

这篇关于仅支持横向界面方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆