Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Writing Macro detect 3.5 inch or 4 inch display [duplicate]

I am trying to write a macro to determine the device is 3.5 inch or 4 inch. Some thing similar below.

    #define IOS_OLDER_THAN_6 ( [ [ [ UIDevice currentDevice ] systemVersion ] floatValue ] < 6.0 )
    #define IOS_NEWER_OR_EQUAL_TO_6 ( [ [ [ UIDevice currentDevice ] systemVersion ] floatValue ] >= 6.0 )

Can someone help me. Please

like image 988
Karthick Avatar asked May 24 '13 09:05

Karthick


3 Answers

Mean something like this:

#define IS_IPHONE5 (([[UIScreen mainScreen] bounds].size.height-568)?NO:YES)
like image 38
Mikael Avatar answered Sep 19 '22 22:09

Mikael


you can detect iphopne 3.5 inch or 4 inch using bellow:-

#define isiPhone5  ([[UIScreen mainScreen] bounds].size.height == 568)?TRUE:FALSE

you can check it using bellow method for example:-

     if (isiPhone5)
     {
           // this is iphone 4 inch
     }
     else
     {

           //Iphone  3.5 inch
     }

Please take a look of this link for you knew all about Macro for determine the device is 3.5 inch or 4 inch.

How to detect iPhone 5 (widescreen devices)?

like image 75
Nitin Gohel Avatar answered Sep 20 '22 22:09

Nitin Gohel


you can check if it is iphone 5 (4 inch) like this:

The iPhone 5's screen has a height of 568.

if ([ [ UIScreen mainScreen ] bounds ].size.height == 568)
like image 22
jonypz Avatar answered Sep 20 '22 22:09

jonypz