我遵循了How To Use the Three20 Photo Viewer by Ray Wenderlich教程,它非常清晰并且运行完美,我的问题是标题为“如何在缩略图 View 中启动Three20 Photo Viewer”?
我非常感谢任何指导或帮助。
最佳答案
您应该使用TTThumbsViewController
而不是TTPhotoViewController
。在three20 TTCategory示例应用程序中有一个很好的例子。TTThumbsViewController
也使用图片来源,因此您无需更改太多代码。您的照片查看器应扩展TTThumbsViewController
并实现TTThumbsViewControllerDelegate
委托(delegate)函数。
您可以在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];
}