|
|
#1 |
|
1 to 1.15 Scaling from iphone to ipad and phone5
Hi all.
I can determine the screen Size by: Code:
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
if ([UIScreen mainScreen].scale == 2.0f) {
CGSize result = [[UIScreen mainScreen] bounds].size;
CGFloat scale = [UIScreen mainScreen].scale;
result = CGSizeMake(result.width * scale, result.height * scale);
scalerX=1;
scalerY=1;
NSLog(@"Screen is X:%f Y:%f",scalerX,scalerY);
if(result.height == 960){
NSLog(@"iPhone 4, 4s Retina Resolution");
}
if(result.height == 1136){
NSLog(@"iPhone 5 Resolution");
}
} else {
NSLog(@"iPhone Standard Resolution");
CGSize result = [[UIScreen mainScreen] bounds].size;
CGFloat scale = [UIScreen mainScreen].scale;
result = CGSizeMake(result.width * scale, result.height * scale);
scalerX=1;
scalerY=1;
NSLog(@"Screen is X:%f Y:%f",scalerX,scalerY);
}
} else {
CGSize result = [[UIScreen mainScreen] bounds].size;
CGFloat scale = [UIScreen mainScreen].scale;
result = CGSizeMake(result.width * scale, result.height * scale);
if ([UIScreen mainScreen].scale == 2.0f) {
NSLog(@"iPad Retina Resolution");
} else{
NSLog(@"iPad Standard Resolution");
}
scalerX=2.0; <--- why does this work better ??
scalerY=2.0;
// tried ratio of 326/163 which is 2 anyway.
NSLog(@"Screen is X:%f Y:%f",scalerX,scalerY);
}
if I multiply the currentX * scalerX it's off also tried Code:
positionX =currentX * scalerX // also tried this .. both are off for ipad // positionX = currentX*(result.width/320); what should I scale by?? thanks Ian |
|
|
|
0
|
|
|
#2 |
|
I'm confused. What are you trying to do and what are you getting?
__________________
Battery Status - On the Mac App Store
The only app that'll estimate when your wireless devices will need their batteries changed. Like it on Facebook! |
|
|
|
0
|
|
|
#3 | |
|
Quote:
iPhone = 320:480 = .6666 iPad = 768:1024 = .7500 iPhone 5 = 320:580 = .5517 The iPad screen is also so much bigger than the iPhone screen that the same layout doesn't usually work. You generally need to rethink your forms design for the iPad, and put more functionality on one screen. For example, in our company's location placemarking app, Save My Place, the iPhone version has a screen for the map view, a separate screen for the list of saved locations, and a third screen for the compass view. On the iPad version, all of that content fits quite nicely on a single screen.
__________________
Regards, Duncan Champney, WareTo. Check out our latest app, Face Dancer, available for free on the App Store. |
||
|
|
0
|
|
|
#4 |
|
Never an easy way out eh? hahaha !!!
Thanks all !!!
Was looking for an easy way out.. but because it was / is my first app. I hard coded the positions. Guess I'm going to have to do it the painful way. Reposition all the graphics by hand.. thanks again.. esp for the Ratios. should help scaling it at least. thanks Ian |
|
|
|
0
|
|
|
#5 | |
|
Quote:
No, you should not reposition everything by hand. You should not hard-code the positions of your views. You should use an XIB or storyboard. If you did that then you could use the "struts and springs" controls in interface builder to make your views adjust automatically to different view sizes and orientations. The idea is that you determine which edges stick to the sides of the containing view (struts), and which sides are allowed to float, and you tell each view if it should stay the same size or resize (springs). You can get pretty flexible resizing behavior that way, and it is a skill you should invest time in learning. Note that iOS 6 includes a more sophisticated resizing system known as autoLayout, but that only works under iOS 6,
__________________
Regards, Duncan Champney, WareTo. Check out our latest app, Face Dancer, available for free on the App Store. |
||
|
|
0
|
|
|
#6 | |
|
Quote:
You don't want to be screwed if Apple comes out with a new device at a different aspect ratio or resolution. |
||
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 03:38 AM.








Linear Mode
