How to detect iPhone 5 (widescreen devices)?

前端 未结 24 2015
我寻月下人不归
我寻月下人不归 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:16

    Relying in the size is wrong in so many levels. How about we ask to the system?

    - (NSString *) getDeviceModel
    {
        struct utsname systemInfo;
        uname(&systemInfo);
        return [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
    }
    

    Taken from Best way to detect hardware type, iPhone4 or iPhone5?, edzio27 answer.

提交回复
热议问题