I'm having an issue when I deploy my app my phone. I am currently building the app on a 3gs, when the view is displayed, it is the iPhone 5 layout that shows, which makes some objects display partially off of the screen.

Is there a way I can detect the iPhone device, and have it display the correct graphics based on what device launched the app? If so, any suggestions would be much appreciated.

Forgive me in advance, I am a little new to Xcode.

Thanks in advance.

有帮助吗?

解决方案

You can use the [UIDevice currentDevice] class method. This will give you information about the device like systemName, systemVersion, model, etc.

If you need to get the screen dimensions instead, you could use the [UIScreen mainScreen] class method. With it you could get the applicationFrame or the screen bounds.

Hope this helps!

其他提示

this one is simple way to recognize device type.

#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
#define IS_IOS6_AND_UP ([[UIDevice currentDevice].systemVersion floatValue] >= 6.0)
#define IS_RETINA ([[UIScreen mainScreen] respondsToSelector:@selector(displayLinkWithTarget:selector:)] && ([UIScreen mainScreen].scale == 2.0))
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top