简体   繁体   English

始终在ipad中以纵向模式打开视图?

[英]Always open a view in portrait mode in view in ipad?

When I navigate from one view to another view, I want to open the view in portrait view only.ie I am navigating from a first view (landscape) to second view. 当我从一个视图导航到另一个视图时,我想只在纵向视图中打开视图。我正在从第一个视图(横向)导航到第二个视图。 I want the second view to always be open in portrait view.In my case when I launch in landscape, the view is in portrait but the device is in landscape mode. 我希望第二个视图始终在纵向视图中打开。在我的情况下,当我在横向中启动时,视图是纵向的,但设备处于横向模式。 The output I expected was if I open the view in portrait and and on rotating it to landscape with no rotation. 我期望的输出是,如果我以纵向打开视图,并将其旋转到横向而没有旋转。

EDIT: 编辑:

If you open the app in portrait and if you given auto-rotate as NO.Then if you rotate the device to landscape,then there will be no rotation in output.I want the same effect when loading a view initially in landscape. 如果您以纵向打开应用程序,并且如果您将自动旋转设置为NO。然后,如果您将设备旋转为横向,则输出中将没有旋转。我希望在最初以横向方式加载视图时具有相同的效果。

I'm pretty sure you cannot use setOrientation anymore, since it is deprecated and apps have been declined for using it. 我很确定你不能再使用setOrientation了,因为它已被弃用,而且应用程序因使用它而被拒绝。

This may be an option for you: 这可能是您的选择:

http://www.iphonedevsdk.com/forum/iphone-sdk-development/33548-alternative-setorientation.html http://www.iphonedevsdk.com/forum/iphone-sdk-development/33548-alternative-setorientation.html

It rotates the view using a transformation. 它使用转换旋转视图。

Okay so what you want to do is edit one of the functions in the view file. 好的,你要做的就是编辑视图文件中的一个功能。 You want to set; 你想要设定;

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
    return YES;
}

From return YES to return (interfaceOrientation == UIInterfaceOrientationPortrait); 从返回YES返回(interfaceOrientation == UIInterfaceOrientationPortrait);

Then your view should only be in potrait. 那你的观点应该只是在potrait。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM