How to detect iPhone 5 (widescreen devices)?

前端 未结 24 1368
我寻月下人不归
我寻月下人不归 2020-11-22 00:50

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 a

24条回答
  •  梦如初夏
    2020-11-22 01:00

    +(BOOL)isDeviceiPhone5
    {
        BOOL iPhone5 = FALSE;
    
        CGRect screenBounds = [[UIScreen mainScreen] bounds];
        if (screenBounds.size.height == 568)
        {
            // code for 4-inch screen
            iPhone5 = TRUE;
        }
        else
        {
            iPhone5 = FALSE;
            // code for 3.5-inch screen
        }
        return iPhone5;
    
    }
    

提交回复
热议问题