Question

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.

Était-ce utile?

La solution

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!

Autres conseils

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))
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top