开发者

How to show a custom TTPhotoView when clicking on a thumb from TTThumbsViewController

I'm creating an image viewer app similar to the facebook app using Three20. When the user clicks on a thumbnail, I would like to show a completely different full image view. Instead of just the image and a caption, I would like to show the image in only a portion of the screen along with some other information from my model. How do I do this?

I've already created a custom TTPhotoViewController and am using it to return a custom TTPhotoView class for the full image views. I don't know how to subclass TTPhotoView such that it can display other information. Because it descends from TTImageView, it appears that it's only able to display the image full screen. There's lots of code in TTImageView having to do with layers and other Objective-C concepts that I'm not familiar with. D开发者_StackOverflow中文版o I need to do something with that? I don't think it's as easy as loading up a NIB and displaying that, but I love it if it was.


In you subclass of TTThumbsPhotoViewer just override this method

- (TTPhotoViewController*)createPhotoViewController {
  return [[[MyTTPhotoViewController alloc] init] autorelease];
}

The solution above works also but this is how is intended to do this. Because in didSelectPhoto method there is more logic what should be done and at the end of this method "createPhoto...." is called for pushing :)


In your inherited class of TTThumbsViewController override this method

- (void)thumbsTableViewCell:(TTThumbsTableViewCell*)cell didSelectPhoto:(id<TTPhoto>)photo 
{
    YourImageViewControler *controller =  [[[YourImageViewControler alloc] initWithNibName:nil bundle:nil] autorelease];

    //Set photo
    [self.navigationController pushViewController:controller animated:YES];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜