斯威夫特 - 让一个设备布局小 [英] Swift - Make layout smaller for one device

查看:122
本文介绍了斯威夫特 - 让一个设备布局小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我不明白了吧制定3,5设备如果布局视图比大,现在的一些布局不适合在3.5的设备,什么是解决这个问题的最好办法,我已经使用大小类和自动布局。有没有什么办法让只为3,5事小?

So I don't get the point to develop for 3,5 devices if the layout view is bigger than that, now some of the layouts doesn't fit in the 3.5 devices, what is the best way to solve it, I am already using Size Classes and Auto Layout. Is there any way to make things smaller just for the 3,5?

推荐答案

您可以检查的 @ HAS回答为一个伟大的扩展来获得设备。你可以简单地扩展自己添加要(外类体)的任何文件。

You can check @HAS answer for a great extension to get the device. You can simply add his extension to any file you want (outside of the class body).

然后,你检查你的设备类型这样的:

Then you check your device type like that:

let model = UIDevice.currentDevice().modelName

if(model == "iPhone 4" || model == "iPhone 4S"){
    //do iPhone 4 stuff
}else{
    //do other stuff
}

这篇关于斯威夫特 - 让一个设备布局小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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