How to detect iPhone 5 (widescreen devices)?
I've just upgraded to XCode 4.5 GM and found out that you can now apply the '4" Retina' size to your view controller in the storyboard.
Now if I want to create an application that runs on both iPhone 4 and 5, of course I have to build every window twice, but I also have to detect whether the user has an iPhone with 3.5" or 4" screen and then apply the view.
How should I do that?
真正简单的解决方案
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
CGSize result = [[UIScreen mainScreen] bounds].size;
if(result.height == 480)
{
// iPhone Classic
}
if(result.height == 568)
{
// iPhone 5
}
}
链接地址: http://www.djcxy.com/p/35124.html
上一篇: 如何确定当前的iPhone /设备型号?
下一篇: 如何检测iPhone 5(宽屏设备)?