自动布局和ios5 [英] Autolayout and ios5

查看:106
本文介绍了自动布局和ios5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用storyboards。我使用汽车布局,但它不工作与ios5和崩溃,所以我想删除它。但是,如何取消选中自动布局。但是如果我取消选中自动布局,我如何为iPhone 4和5设置我的屏幕

I am using storyboards. I have used auto layout but its not working with ios5 and give crashes so I want to remove it. However, How can I uncheck the auto layout. But if I uncheck auto layout, How can i set my screens for both iPhone 4 and 5

注意

推荐答案

您可以禁用IB中的自动布局,但在视图控制器中根据设备上的iOS版本是否支持它来设置约束,例如,检查NSLayoutConstraint类是否可以找到:

You can disable autolayout in IB but set the constraints programatically in the view controller, based on whether the iOS version on the device supports it or not by, for example, checking if the NSLayoutConstraint class can be found:

if (NSClassFromString(@"NSLayoutConstraint")) {
    //create constraints
}

有关创建实际约束的更多信息可以在这里找到: http://www.techotopia.com/index.php/Implementing_iOS_6_Auto_Layout_Constraints_in_Code

More info on creating the actual constraints can be found here: http://www.techotopia.com/index.php/Implementing_iOS_6_Auto_Layout_Constraints_in_Code

这篇关于自动布局和ios5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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