在iPhone 4、iPhone 5和iPad的用户界面方面有所区别
可能重复:在iPhone 4、iPhone 5和iPad的用户界面方面有所区别,iphone,ios,ipad,Iphone,Ios,Ipad,可能重复: 我们可以通过以下方式区分iPad和iPhone UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone/UIUserInterfaceIdiomPad 但是如何根据用户来区分iPhone4和iPhone5呢 请注意,如果不想,不必将其定义为宏。简化版: if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) { if (
我们可以通过以下方式区分iPad和iPhone
UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone/UIUserInterfaceIdiomPad
但是如何根据用户来区分iPhone4和iPhone5呢
请注意,如果不想,不必将其定义为宏。简化版:
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
if ([[UIScreen mainScreen] bounds].size.height == 568) {
//5
}else{
//not 5
}
}else{
//iPad
}
是的,这在景观中有效。即使设备的方向已更改,但设备高度保持不变。获取UI屏幕的高度与获取视图的高度不同。引用:
请注意,如果不想,不必将其定义为宏。简化版:
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
if ([[UIScreen mainScreen] bounds].size.height == 568) {
//5
}else{
//not 5
}
}else{
//iPad
}
是的,这在景观中有效。即使设备的方向已更改,但设备高度保持不变。获取UI屏幕的高度与获取视图的高度不同。在横向方向上有效吗?在横向方向上有效吗?
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
if ([[UIScreen mainScreen] bounds].size.height == 568) {
//5
}else{
//not 5
}
}else{
//iPad
}