简体   繁体   English

将视图从横向转换为纵向?

[英]Converting View from Landscape to Portrait?

I have already developed the app for Landscape mode,now the client is asking to build in both Landscape and Portrait mode. 我已经开发了横向模式的应用程序,现在客户端要求在横向和纵向模式下构建。

How can i convert landscape View to portrait View? 如何将横向视图转换为纵向视图?

Now i am using this code for Landscape View: 现在我将此代码用于Landscape View:

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{

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

 }

Please help me.... 请帮我....

Advance Thanks :) 预付谢谢:)

Simple, to support all orientations just return YES to shouldAutorotateToInterfaceOrientation . 很简单,为了支持所有方向,只需返回YES来指定shouldAutorotateToInterfaceOrientation

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    return YES;
    //Or to support all but portrait upside down
    return interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown;
}

Learn how to use autoresizing masks. 了解如何使用自动调整遮罩。 They are simple but pretty powerful in a majority of cases. 它们很简单,但在大多数情况下非常强大。

NSPostWhenIdle is right. NSPostWhenIdle是对的。 You just have to return yes shouldAutorotateToInterfaceOrientation. 你只需要返回yes shouldAutorotateToInterfaceOrientation。 That way you can have support for all orientations. 这样你就可以支持所有方向。 Have a look at resizing properties through XIB. 看看通过XIB调整属性大小。 that will also make your work easy. 这也将使您的工作变得轻松。

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

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