3

有没有办法将当前图像获取到 UIImage 的对象?我尝试将 TTPhoto 转换为 UIImage,但它不起作用。

4

2 回答 2

2

我做了不同的事情。我的照片源是使用 JSON 数据生成的,所以我不能使用上面的方法,因为照片源每次都不一样。相反,我使用 TTPhoto 上的 URLForVersion 方法将图像下载到 UIImage 中。

NSURL *imageURL = [NSURL URLWithString:[self.centerPhoto URLForVersion:TTPhotoVersionLarge]];
NSData *imageData = [NSData dataWithContentsOfURL:imageURL];
UIImage *image = [UIImage imageWithData:imageData];
于 2012-02-01T07:06:21.600 回答
1

我想到了。我们可以使用 TTPhotoViewController 的实例变量 centerImageIndex。这将为我们提供当前图像的索引。

于 2011-12-13T14:03:10.637 回答