2015-07-21 49 views
0

是否有一個功能來檢查用戶正在使用的設備?迅速檢查設備是否爲iphone 5或6或ipad

在我的一個視圖控制器中,我在scrollview中有一個視圖。在這個觀點中,我有一些文字輸入。然後,我改變該視圖上的高度位置,以防止鍵盤位於視圖/輸入之上。

我不需要相比,iPhone 5

+0

可能重複[iOS - 如何獲取設備製造和模型?](http://stackoverflow.com/questions/11197509/ios-how-to-get-device-make-and-model) – brandonscript

+0

這是一個常見的問題。看看這個答案: http://stackoverflow.com/questions/26028918/ios-how-to-determine-iphone-model-in-swift – StateOfB

+0

爲什麼不使用自動佈局或獲得窗口高度工作呢? – NSDeveloper

回答

-1
print(UIDevice.currentDevice().name) 

會得到你想要,你要移動的視圖儘可能多的在iPhone 6。

+1

這將打印例如「史蒂文斯Iphone」 –