Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect if the device is an iPhone 5? [duplicate]

Tags:

xcode

ios

Possible Duplicate:
How to detect iPhone 5 (widescreen devices)?

I am trying to add a new view to an existing ios4 project to handle the new iphone5 screen size.

However I dont have an iphone here to test on and the code I am using to test the screen size isnt working, just wondering if there is another way of detecting the device type??

NSLog(@"%f", [ [ UIScreen mainScreen ] bounds ].size.height);

if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
    if([UIScreen mainScreen].bounds.size.height == 568.0)
    {
        //move to your iphone5 storyboard
        [self changeView:splashScreenBIGV viewH:splashScreenH animLength:SCREEN_CHANGE_ANIM_LENGTH];
   }
    else{
        //move to your iphone4s storyboard
        [self changeView:splashScreenV viewH:splashScreenH animLength:SCREEN_CHANGE_ANIM_LENGTH];            
    }
}
like image 376
hanimal_p Avatar asked Sep 26 '12 15:09

hanimal_p


People also ask

Does iPhone 5 have tracking?

Go to iCloud.com and sign in with the same Apple ID you use on your iPhone 5. Once you log in, you'll see the same radar icon for “Find My iPhone.” Click it. That will take you to another page that'll show you where your iPhone and other Apple devices you have are on a Google map.

How do I find my device manufacturer iPhone?

Go to Settings > General > About. To the right of Model, you'll see the part number.

How do I know if my iPhone is brand new?

Find Your iPhone's Model NumberIf the model number starts with M, it was purchased new from Apple. If the model number starts with F, it was refurbished by Apple or a carrier. If the model number starts with P, it was sold as a personalized iPhone with an engraving.


1 Answers

For my universal app, Forex App, I'm simply using the screen height detection concept like so:

CGSize screenSize = [[UIScreen mainScreen] bounds].size;

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
    if (screenSize.height > 480.0f) {
        /*Do iPhone 5 stuff here.*/
    } else {
        /*Do iPhone Classic stuff here.*/
    }
} else {
    /*Do iPad stuff here.*/
}
like image 93
DataPriest Avatar answered Nov 15 '22 22:11

DataPriest