如果设备是 iPad mini 而不是普通 iPad,我需要知道下面的代码是否会返回 iPad:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
// The device is an iPad running iPhone 3.2 or later.
}
else {
// The device is an iPhone or iPod touch.
}
最佳答案
会的。看一下 UIUserInterfaceIdiom
的定义,只有两个选项,每个选项都表示它们代表一种 UI 风格。只有 iPad 在 iPad mini 的背景下才有意义。
typedef NS_ENUM(NSInteger, UIUserInterfaceIdiom) {
#if __IPHONE_3_2 <= __IPHONE_OS_VERSION_MAX_ALLOWED
UIUserInterfaceIdiomPhone, // iPhone and iPod touch style UI
UIUserInterfaceIdiomPad, // iPad style UI
#endif
};
关于ios - UIUserInterfaceIdiomPad 将如何响应 iPad mini,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19410346/