-4

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

I would to know if there is a simple method to know if the device is iPhone 4 or iPhone 5 ? Maybe there is a global variable that stocks this information ? I would like to do something like this :

 if (device == iphone 5){
 frame.size = 300px;
 }
 else if (device == iphone 4){
 frame.size =  200px;
 }

Just a very simple example.

Community
  • 1
  • 1
frénésie
  • 1,716
  • 3
  • 16
  • 14
  • Yes and no. As you can see in the link you gave me, they discuss about severals methods, whereas I just posted my case and had a perfect good answer. See NANNAV's answer :) – frénésie Dec 04 '12 at 12:30
  • You mean the answer copied verbatim from [this](http://stackoverflow.com/a/12587966/64976)? – J. Steen Dec 04 '12 at 12:37
  • NANNAV could have added the answer there and avoided polluting SO with duplicate questions and answers. – Abizern Dec 04 '12 at 12:37

2 Answers2

0
[[UIDevice currentDevice] localizedModel]
AppleDelegate
  • 4,269
  • 1
  • 20
  • 27
-1
 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
     CGRect screenBounds = [[UIScreen mainScreen] bounds];
    if (screenBounds.size.height == 568)
 {
    //For iPhone5
 }

else
{
   //for iPhone4 and all other

}
alex
  • 518
  • 3
  • 10