我有一个 iPhone 5 和一个 iPhone 4s,我正在测试一个 xcode 项目。我在 iPhone 5 上删除了我的应用程序并重新构建它,现在它将 iphone 5 识别为 iphone 4。我都尝试过
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
NSLog(@"screen size is %f", screenSize.height);
if (screenSize.height > 480.0f) {
return TRUE;
} else {
return FALSE;
}
}
和
#define IS_WIDESCREEN ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
#define IS_IPHONE ( [ [ [ UIDevice currentDevice ] model ] isEqualToString: @"iPhone" ] )
#define IS_IPOD ( [ [ [ UIDevice currentDevice ] model ] isEqualToString: @"iPod touch" ] )
#define IS_IPHONE_5 ( IS_IPHONE && IS_WIDESCREEN )
问题是 [UIScreen mainScreen]bounds.size.height 以某种方式将我的屏幕高度识别为 480.00000 而不是 586。有没有人遇到过这个错误,我该如何解决?