First of all, you shouldn't rebuild all your views to fit a new screen, nor use different views for different screen sizes.
Use the auto-resizing capabilities of iOS, so your views can adjust, and adapt any screen size.
That's not very hard, read some documentation about that. It will save you a lot of time.
iOS 6 also offers new features about this, but this is still under NDA at the moment.
Be sure to read the API changelog on Apple Developer website, if you can access to it.
That said, if you really need to detect the iPhone 5, you can simply rely on the screen size.
[ [ UIScreen mainScreen ] bounds ].size.height The iPhone 5's screen has a height of 568.
You can imagine a macro, to simplify all of this:
#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON ) The use of fabs with the epsilon is here to prevent precision errors, when comparing floating points, as pointed in the comments by H2CO3.
So from now on you can use it in standard if/else statements:
if( IS_IPHONE_5 ) {} else {} Edit
As stated by some people, this does only detect a widescreen, not an actual iPhone 5.
Next versions of the iPod touch will maybe also have such a screen, so we may use another set of macros.
Let's rename the original macro IS_WIDESCREEN:
#define IS_WIDESCREEN ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON ) And let's add model detection macros:
#define IS_IPHONE ( [ [ [ UIDevice currentDevice ] model ] isEqualToString: @"iPhone" ] ) #define IS_IPOD ( [ [ [ UIDevice currentDevice ] model ] isEqualToString: @"iPod touch" ] ) This way, we can ensure we have an iPhone model AND a widescreen, and we can redefine the IS_IPHONE_5 macro:
#define IS_IPHONE_5 ( IS_IPHONE && IS_WIDESCREEN ) Final note
Comments and suggestions have been incorporated in this post.
Thanks to everybody.