简体   繁体   English

快速检查设备是否为iPhone 5或6或iPad

[英]swift check if device is iphone 5 or 6 or ipad

Is there a function to check what device the user is using? 是否具有检查用户使用哪种设备的功能?

In one of my View Controllers I have a view inside a scrollview. 在我的一个视图控制器中,我在scrollview中有一个视图。 In that view I have some text inputs. 在这种视图下,我有一些文本输入。 Then I change the height position on that view in order to prevent the keyboard from being on top of the view/inputs. 然后,我更改该视图上的高度位置,以防止键盘位于视图/输入的顶部。

I don't need to move the view as much on an iPhone 6 compared to an iPhone 5. 与iPhone 5相比,我不需要在iPhone 6上移动太多视图。

print(UIDevice.currentDevice().name)

会得到你想要的。

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

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