TTLauncherItem with image from documents folder

17 views
Skip to first unread message

hush

unread,
Jan 25, 2010, 6:55:52 AM1/25/10
to Three20
Hi there!

I'd like to have a TTLauncherItem with image from documents folder?
How do I go about this?

Thanks!

Message has been deleted

hush

unread,
Jan 25, 2010, 8:23:12 AM1/25/10
to Three20
Ok, people, since it was terribly urgent, I had to dive in it by
myself ;]

My solution is fairly simple. I use TTURLCache class to store the
image for particular URL and later pass that URL to TTLauncherItem
image property:

//get the image
NSString *fileName = @"MyThumbnail.png";
NSArray *paths = NSSearchPathForDirectoriesInDomains
(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *imageFilePath = [documentsDirectory
stringByAppendingPathComponent:fileName];
UIImage *thumbnail = [UIImage imageWithContentsOfFile:imageFilePath];

//store the image
[[TTURLCache sharedCache] storeImage:thumbnail forURL:fileName];

//create TTLauncherItem with that image
TTLauncherItem *item = [[[TTLauncherItem alloc] initWithTitle:@"Some
Title" image:fileName URL:@"itemURL" canDelete:NO] autorelease];

Voila! ;]
Hope that helps someone, cheers ;]

uprise78

unread,
Jan 25, 2010, 1:13:49 PM1/25/10
to Three20
Or you can just use @"documents://someFile.png"
Reply all
Reply to author
Forward
0 new messages