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

Ahm*_*ali 8 iphone thumbnails three20 ios

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

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

apo*_*rat 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];

}
Run Code Online (Sandbox Code Playgroud)