简体   繁体   English

如何在IOS6,IOS7和IOS 8中处理方向委托方法?

[英]How to handle orientation delegate method in IOS6, IOS7 and IOS 8?

I am working on the new iphone app and I have to give orientation support in all IOS version(ios 6 and later). 我正在开发新的iPhone应用程序,并且必须在所有IOS版本(iOS 6及更高版本)中提供方向支持。 can anybody explain what is the best way to handle orientation for all IOS versions. 谁能解释所有IOS版本处理方向的最佳方法是什么。

I searched and found that few of older version delegate methods have been deprecated in the newer version of IOS. 我搜索后发现,较新版本的IOS不推荐使用较早版本的委托方法。

How should I manage of this? 我应该如何处理? Please provide idea. 请提供想法。

Thanks In advance. 提前致谢。

In iOS7 & iOS8 you can use auto layout and size classes when you create a new project a 600x600 resolution ViewController is added you have to add constraints on that ViewController then it will run same on all devices 在iOS7和iOS8中,当您创建新项目时,可以使用自动布局和大小类。添加600x600分辨率的ViewController时,您必须在该ViewController上添加约束,然后它才能在所有设备上运行

For auto layout you can follow these tutorials 对于自动布局,您可以按照以下教程进行

1-[http://www.raywenderlich.com/83276/beginning-adaptive-layout-tutorial][1]
2-[http://www.appcoda.com/introduction-auto-layout/][2]
3-[http://www.brianjcoleman.com/autolayout-xcode6/][3]
Even it will run on iPads too.

thanks 谢谢

I think those three methods can meet your requirement. 我认为这三种方法可以满足您的要求。

- (BOOL)shouldAutorotate NS_AVAILABLE_IOS(6_0);
- (NSUInteger)supportedInterfaceOrientations NS_AVAILABLE_IOS(6_0);
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation NS_AVAILABLE_IOS(6_0);

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

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