Hello, I've successfully implemented TTThumbsViewController.
Now I would to open a TTPhotoViewController in order to browse my photo.
Below the code I've used (it's called when users click a row in a normal UITableView)
Everything works fine but when the single image loads app crashes with this error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPlaceholderString initWithFormat:locale:arguments:]: nil argument'
This is the stack frame image:
Imageshack - screenshot20091004at130
Any idea?
Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
BMWStandardTableCell *cell = ((BMWStandardTableCell*)[tableView cellForRowAtIndexPath:indexPath]);
// Display the updated photoSource.
[_photoshource release];
[thumbs_controller release];
_photoshource = [[self dataSourceForList: [_x_fetcher galleryForTitle:cell.fld_line1.text]
withTitle: cell.fld_line1.text] retain];
thumbs_controller = [[TTThumbsViewController alloc] init];
[thumbs_controller setPhotoSource:_photoshource];
thumbs_controller.delegate = self;
[self.navigationController pushViewController:thumbs_controller animated:YES];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
- (void)thumbsViewController:(TTThumbsViewController*)controller didSelectPhoto:(id<TTPhoto>)photo {
[_photocontroller release];
_photocontroller = [[controller createPhotoViewController] retain];
_photocontroller.centerPhoto = photo;
[self.navigationController pushViewController:_photocontroller animated:YES];
}
- (MockPhotoSource *) dataSourceForList:(NSArray *) _array withTitle:(NSString *) _ptitle {
NSMutableArray *_list = [[NSMutableArray alloc] init];
[_list addObject: [[[MockPhoto alloc]
initWithURL:@"http://farm4.static.flickr.com/3106/3203111597_d849ef615b.jpg?v=0"
smallURL:@"http://farm4.static.flickr.com/3106/3203111597_d849ef615b_t.jpg"
size:CGSizeMake(320, 480)] autorelease]];
/*
for (BMWGalleryResource *gItem in _array) {
NSString *_galleryURL = [NSString stringWithFormat:kGalleryThumbURLFormat,gItem.p_photoID_link];
MockPhoto *_photo = [[[MockPhoto alloc] initWithURL: _galleryURL
smallURL: _galleryURL
size:CGSizeMake(960, 1280)] autorelease];
[_photo setCaption:@"merda"];
[_list addObject:_photo];
[_photo release];
}*/
MockPhotoSource *source= [[MockPhotoSource alloc] initWithType:MockPhotoSourceNormal
title:_ptitle
photos:_list
photos2:_list];
[_list release];
return [source autorelease];
}