如何让TTPhotoViewController显示UIImage?

时间:2010-06-21 14:40:40

标签: iphone uiimage three20 ttphotoviewcontroller

我想要使用TTPhotoViewController显示UIImage,但是TTPhotoViewController不会将UIImage作为参数。它确实需要一个TTPhoto作为参数,所以我想知道是否有办法将UIImage转换为TTPhoto,或者是否有任何其他方法可以让TTPhotoViewController显示我的UIImage,而不是设置defaultImage,它没有'太好了。

4 个答案:

答案 0 :(得分:7)

我用一点点黑客来做:

NSString *url = [[TTURLCache sharedCache] createUniqueTemporaryURL];    
[[TTURLCache sharedCache] storeImage:baseImage forURL:url force:YES];

PEPhotoViewController *album=[[[PEPhotoViewController alloc] initWithImageURL:url] autorelease];

答案 1 :(得分:3)

您需要创建符合TTPhotoSource协议的对象,并实现所需的方法。然后,您需要使用符合TTPhoto协议的对象填充该数据源。

然后你应该能够在TTPhotoViewController上设置照片源属性,而Three20的魔法应该可以工作。

根据我自己的经验,我只使用这个框架的URL到图像并使用Three20的TTModel框架下载它们。我不完全确定这会如何影响本地加载图像。

答案 2 :(得分:1)

您可以提供图书馆的本地路径。应为bandle://documents://。看一下TTCatalog示例源。

答案 3 :(得分:0)

只需将self.defaultImage设置为您的图片即可。它应该工作。