iOS 判断设备类型是iPhone 还是iPad
2020-04-13 本文已影响0人
Eyes_cc
/*
public enum UIUserInterfaceIdiom : Int {
case unspecified
@available(iOS 3.2, *)
case phone // iPhone and iPod touch style UI
@available(iOS 3.2, *)
case pad // iPad style UI
@available(iOS 9.0, *)
case tv // Apple TV style UI
@available(iOS 9.0, *)
case carPlay // CarPlay style UI
}
*/
if UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.phone {
// iPhone
}
if UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.pad {
// iPad
}