iOSアプリ開発のメモ置き場

ささたつがiOSアプリ開発で知ったObjective-Cのtipsなどを書いていく所存

URLだけわかっていて画像を表示したい

SDWebImage の downloadWithURL:options:progress:completed: を使う。

[[SDWebImageManager sharedManager] downloadWithURL:imageURL
                                                   options:SDWebImageHighPriority
                                                  progress:nil
                                                 completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) {
            if (error) {
                [Bugsnag notify:[NSException exceptionWithName:@"Download Image Exception" reason:error.localizedDescription userInfo:nil]];
            } else if (finished) {
                self.contentTextView.image = image;
            }
        }];