【发布时间】:2011-12-08 05:09:33
【问题描述】:
有没有办法将当前图像获取到 UIImage 的对象?我曾尝试将 TTPhoto 转换为 UIImage,但它不起作用。
【问题讨论】:
标签: iphone ios three20 ttphotoviewcontroller
有没有办法将当前图像获取到 UIImage 的对象?我曾尝试将 TTPhoto 转换为 UIImage,但它不起作用。
【问题讨论】:
标签: iphone ios three20 ttphotoviewcontroller
我做了不同的事情。我的照片源是使用 JSON 数据生成的,所以我不能使用上面的方法,因为照片源每次都不一样。相反,我使用 TTPhoto 上的 URLForVersion 方法将图像下载到 UIImage 中。
NSURL *imageURL = [NSURL URLWithString:[self.centerPhoto URLForVersion:TTPhotoVersionLarge]];
NSData *imageData = [NSData dataWithContentsOfURL:imageURL];
UIImage *image = [UIImage imageWithData:imageData];
【讨论】:
我想通了。我们可以使用 TTPhotoViewController 的实例变量 centerImageIndex。这将为我们提供当前图像的索引。
【讨论】: