I am trying to place an ad, while it looks perfect in the iPhone 5/5s it looks bad in the 4/4s.
Is there a way in my method to tell
if device == iphone4/4s
do this
if device == iphone5/5s
do that?
Thank you.
I am trying to place an ad, while it looks perfect in the iPhone 5/5s it looks bad in the 4/4s.
Is there a way in my method to tell
if device == iphone4/4s
do this
if device == iphone5/5s
do that?
Thank you.
Don't do separate code for iPhone4 and iPhone 5 use AutoLayout/ Auto resize.
You can find the device based on the screen size. get device screen size
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height;
if(screenHeight > 480)
{
//iphone 5
}
else
{
//iphone 4or 4s or 3 or 3s
}
Note :
Window size(including status bar)
iPhone 4S (and earlier) -320 x 480 pts
iPhone 5 -320 x 568 pts
Check the screen bounds
if ([UIScreen mainScreen].bounds.size.height == 568)
{
//change the frame of the ad here
}
else
{
//change the frame of the ad here
}
or use autolayout in your interface file