首页 > 解决方案 > ios中的UIUserInterfaceIdiomPad

问题描述

ios中的UIUserInterfaceIdiomPad为什么要用?

在我的 mac book pro ipad 刺​​激器中

  BOOL isIPad2 = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad &&
                        [UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]);

标签: ios

解决方案


UIUserInterfaceIdiomPad 用于了解当前设备是什么。来自苹果文档

对于通用应用程序,您可以使用此属性为特定类型的设备定制应用程序的行为。例如,iPhone 和 iPad 设备具有不同的屏幕尺寸,因此您可能希望根据当前设备的类型创建不同的视图和控件。


推荐阅读