如何在缩略图视图中启动Three20 Photo Viewer?

时间:2011-09-21 12:16:14

标签: iphone ios three20 thumbnails

我按照How To Use the Three20 Photo Viewer by Ray Wenderlich教程非常清楚并且工作得很好,我的问题是标题,如何在缩略图视图中启动Three20 Photo Viewer?

我非常感谢任何指导或帮助。

1 个答案:

答案 0 :(得分:2)

您应该使用TTThumbsViewController代替TTPhotoViewController。在three20 TTCategory示例应用程序中有一个很好的例子。

TTThumbsViewController也使用了照片来源,因此您无需更改那么多代码。您的照片查看器应扩展TTThumbsViewController并实施TTThumbsViewControllerDelegate委托功能。

您可以在viewDidLoad函数中加载照片源:

///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)viewDidLoad {
  NSMutableArray* photos = [NSMutableArray array];
  for (int i=kImagesCount;i>=1;i--) {
    Photo* photo = [[[Photo alloc] initWithURL:[NSString stringWithFormat:@"bundle://%d.png", i]
                                      smallURL:[NSString stringWithFormat:@"bundle://%dt.png", i]
                                          size:CGSizeMake(400, 400)] autorelease];
    [photos addObject:photo];
  }

  self.photoSource = [[PhotoSource alloc]
                      initWithType:PhotoSourceNormal
                      title:@"Select Picture"
                      photos:photos 
                      photos2:nil];

}
相关问题