Hahaa get it.. ??? ok never mind..
So I have an app that was iphone 4 or 3.5 only and it worked on the iphone 5 with boarder.. I updated it to be full frame and iphone 5 aware if you install it new it recognizes it's on a iphone 5 and everything is fine.
But if it's a the old version updated. This code doesn't seem to be working..
but it doesn't seem to be reading correctly. because size seems off.
Do I have to check actual models
***also any idea how to test this in the simulate upgrades, because the simulator and Xcode always seems to compile it as a new app. Which works fine
what it should look like.
What it does
*** The hint actually is that although both images came from a iphone 5 they are different resolutions.
below is 496 × 880 pixels well above is 640 × 1136 pixels wacky.. I would think the iphone5 would just stretch the image not change screen resolutions.
thinking this might be the answer. #1
thanks for any suggestions.
Ian
Is this a bad idea? Apple suggest not to use this why?
So I have an app that was iphone 4 or 3.5 only and it worked on the iphone 5 with boarder.. I updated it to be full frame and iphone 5 aware if you install it new it recognizes it's on a iphone 5 and everything is fine.
But if it's a the old version updated. This code doesn't seem to be working..
Code:
#define IS_IPHONE5 (([[UIScreen mainScreen] bounds].size.height-568)?NO:YES)
#define SCALEYFOR5 1.19 ; //1.18333333
#define SCALEYFOR35 1.0;
#define SCALEXFOR5 1;
#define SCALEXFOR35 1;
// else where resize buttons //
if (IS_IPHONE5) {
btFrame.origin.y = btFrame.origin.y * (scaleYPhone+0.05); // 0.04
}else{
btFrame.origin.y = btFrame.origin.y * scaleYPhone;
}
moveShuf.frame = btFrame;
CGRect btFrameR = moveRest.frame;
btFrameR.origin.x = btFrameR.origin.x * scaleXPhone;
if (IS_IPHONE5) {
btFrameR.origin.y = btFrameR.origin.y * (scaleYPhone+0.02); // 0.04
}else{
btFrameR.origin.y = btFrameR.origin.y * scaleYPhone;
}
moveRest.frame = btFrameR;
// and other stuff that resizes it.
if (IS_IPHONE5) {
btFrame.origin.y = btFrame.origin.y * (scaleYPhone+0.05); // 0.04
}else{
btFrame.origin.y = btFrame.origin.y * scaleYPhone;
}
}
but it doesn't seem to be reading correctly. because size seems off.
Do I have to check actual models
***also any idea how to test this in the simulate upgrades, because the simulator and Xcode always seems to compile it as a new app. Which works fine
what it should look like.

What it does
*** The hint actually is that although both images came from a iphone 5 they are different resolutions.
below is 496 × 880 pixels well above is 640 × 1136 pixels wacky.. I would think the iphone5 would just stretch the image not change screen resolutions.

thinking this might be the answer. #1
Code:
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_IPHONE_5 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 568.0)
#define IS_RETINA ([[UIScreen mainScreen] scale] == 2.0)
thanks for any suggestions.
Ian
Is this a bad idea? Apple suggest not to use this why?
Code:
#import <sys/utsname.h>
#define IS_IPHONE5 ((([deviceName() rangeOfString:@"iPhone5,"].location != NSNotFound)||([deviceName() rangeOfString:@"iPhone6,"].location != NSNotFound))?NO:YES)
NSString* deviceName()
{
struct utsname systemInformation;
uname(&systemInformation);
NSString *result = [NSString stringWithCString:systemInformation.machine
encoding:NSUTF8StringEncoding];
NSLog(@"Device is a:%@",result);
return result;
}
// When I put this same code in another object it gives me a duplicate compile error !! ?Hun? //
* not using above because previous answer #! code works without issue and is Apple sanctioned... hahah!!!
** Think the problem was that I initialize / save the the screen and never update it later.. So bad. I think best practices for this sort of thing is to dynamically calculate these values.. fingers crossed.
Last edited: