Best way to programmatically detect iPad/iPhone hardware

前端 未结 10 921
借酒劲吻你
借酒劲吻你 2020-11-27 14:14

The reason I need to find out is that on an iPad, a UIPickerView has the same height in landscape orientation as it does in portrait. On an iPhone it is different. The iPad

10条回答
  •  Happy的楠姐
    2020-11-27 14:43

    extension UIDevice {
    
       var isIPad: Bool {
          return UIDevice.current.userInterfaceIdiom == .pad
       }
    }
    

提交回复
热议问题