Three20,TTLauncherItem set the image not in @"bundle://12.png"

1.1k views Asked by At

if the image of TTLauncherItem is not from @"bundle://12.png" but as the following, it would not appear as a image.

    [pageArray addObject:[[[TTLauncherItem alloc] initWithTitle:[titleArray objectAtIndex:(j+i*pageCount)]
                                                                  image:@"/Users/alex/Library/Application Support/iPhone Simulator/4.1/Applications/457F60DD-86EF-42E3-95F5-3BFC7C223987/Documents/magazine_covers/12.png"
                                                                    URL:@"tt://setUp" 
                                                              canDelete:NO] autorelease]];

Does this kind of init is not supported?

2

There are 2 answers

0
coneybeare On

iOS apps have no access to your local filesystem. Use the documents keyword instead of the bundle. A quick look at the code shows that it handles nested directories too.

@"documents://12.png"

Source: Three20 source code

1
Lior Bornshtain On

I am not sure about a direct URL to an image on the file system. But I do the following for using an image within my project as a TTLauncherItem image:

NSString* imageName  = @"my-sweet-icon.png";
UIImage* thumbnail = [UIImage imageNamed:@"mySweetImage.png"]; 
[[TTURLCache sharedCache] storeImage:thumbnail forURL:imageName]; 
TTLauncherItem* item1 =  [[[TTLauncherItem alloc] initWithTitle:@"Title"
                                                        image:imageName  
                                                        URL:@"tt://url" canDelete:NO] autorelease];