How can I find out what device a user is using? The code I currently use is:
CGRect screenBounds = [[UIScreen mainScreen] bounds];
if(screenBounds.size.height == 568){
NSLog(@"User is using an iPhone 5s, 5c, or 5");
}
else{
NSLog(@"User is using an iPhone 4s or earlier");
}
What other numbers could this return, and what device would it be? For example, I was hoping for something like this:
screenBounds.size.height == 568
would be an iPhone5/5s/5c
screenBounds.size.height == 480
would be an iPhone 4/5s
screenBounds.size.height > 570
would be an iPad
and so on. I'm going to be using this to change the nib
file based on what device the user is using, so that I won't have to move every single button, image, label, or anything else with CGRectMake
.
I'm not using auto layout because I would also like to have some more customization based on what device the user is using.