【问题标题】:TTPhotoViewController get current center image?TTPhotoViewController 获取当前中心图像?
【发布时间】:2011-12-08 05:09:33
【问题描述】:

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

【问题讨论】:

    标签: iphone ios three20 ttphotoviewcontroller


    【解决方案1】:

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

    NSURL *imageURL = [NSURL URLWithString:[self.centerPhoto URLForVersion:TTPhotoVersionLarge]];
    NSData *imageData = [NSData dataWithContentsOfURL:imageURL];
    UIImage *image = [UIImage imageWithData:imageData];
    

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-04-12
        • 2013-06-24
        相关资源
        最近更新 更多