I am using Three20's TTLauncherView
and was wondering whether anyone has had experience loading high resolution images?
http://three20.info/showcase/launcher
I am using the following method to set my TTLauncherItem
's:
NSString *imageUrl = [self displayImageUrl:@"http://foo.com/lowres.png" withHighResUrl:@"http://foo.com/hires.png";
TTLauncherItem *launcherItem = [[[TTLauncherItem alloc] initWithTitle:@"Icon1"
image:imageUrl
URL:@"Icon1"
canDelete:NO] autorelease];
This is the method I use to determine whether it's an iOS4.
- (NSString *)displayImageUrl:(NSString *)standardResUrl withHighResUrl:(NSString *)highResUrl {
NSString *imageUrl = nil;
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2) {
imageUrl = highResUrl;
} else {
imageUrl = standardResUrl;
}
return imageUrl;
}
The problem is that images are actually getting displayed in their full dimensions on an iPhone 4, whereas any iOS device below an iPhone 4 are getting displayed properly. Just wondering whether I would need to make changes to the TTLauncherView
library or whether there's an easier way to resolve such an issue.
I accomplished this by adding a new style to my three20 stylesheet based on launcherButtonImage. This is the original...
...and this is the updated version...
There's probably stuff in there you don't need like rounded image corners. The operative part is the TTImageStyle directive which locks the image size to 64x64. Hope this helps.