First off this process has been made easier more recently by a app from the Mac App Store called "Unretina". Before this handily app I was doubling to use of 'save for web' command in photoshop for each png asset I was saving out. The first where I would save at 100% and name the file with the @2x convention. Then a second at 50% and without the @2x.
With these two resolutions I try to plan and account for the small amount of screen spacial difference between 960px and 1024px. Then it's off to the controllers. When I first saw iPad samples the lesson was to make separate controllers for the iPhone vs iPad. These two controllers would ultimately link to two different xib files for the layout. Sometimes in the design of an app it was necessary, the extra space just needed extra designs to be a better user experience. Other times my designs, or designs I was given where the same, just in HD. I decided to forgo the double xib files so I'd have half less files to edit every time a change request came across my desk and I learned how to make a expanded class.
To me this made a lot of sense and worked out beautifully when making Top Chef Foodie Fight. I expanded the UIImage class to fit my need. To make a universal app of the same game play interface. Starting with just expanding a new class level method in UIImage that was nearly one I used often everywhere I coded. Instead of [UIImage imageNamed:]; which already does the leg work for retina displays and loading in files named @2x. I wanted to also have iPad devices use the same high-rez image.
#import "UIImage-Expanded.h"
@implementation UIImage (expanded)
+ (UIImage*)image:(NSString*)fileName {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
return [UIImage imageNamed:[fileName stringByAppendingString:@"@2x.png"]];
} else {
return [UIImage imageNamed:fileName];
}
}
@end
This did mean that I had to change the way I use of the class method to just "image:" where I needed the high-rez images loaded. Which left me with a lot less controller classes to duplicate, and not need to save another set of assets nicknamed "-HD"
No comments:
Post a Comment