画像リンクがあります。この画像をアプリに読み込み、カテゴリを使用したいと思います
[test setImageWithURL:[NSURL URLWithString:@"close"]];
リンク画像は:
close
リンク画像は大丈夫ですが、imageviewは画像を読み込めません。理由を教えてください、ありがとう!
画像リンクがあります。この画像をアプリに読み込み、カテゴリを使用したいと思います
[test setImageWithURL:[NSURL URLWithString:@"close"]];
リンク画像は:
close
リンク画像は大丈夫ですが、imageviewは画像を読み込めません。理由を教えてください、ありがとう!
test
UIImageView オブジェクトですか? そうである必要があります。
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 100.0f, 100.0f)];
[imageView setImageWithURL:[NSURL URLWithString:@"http://i.imgur.com/r4uwx.jpg"] placeholderImage:[UIImage imageNamed:@"placeholder-avatar"]];
わかりましたこれを試してください
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
dispatch_async(queue, ^(void) {
NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://216.57.222.146:8080/Stafflink_Web/images/assets/5108029/5108029_0_resized.jpg"];
UIImage* image = [[UIImage alloc] initWithData:imageData];
if (image) {
dispatch_async(dispatch_get_main_queue(), ^{
if (cell.tag == indexPath.row) {
test.image = image;
}
});
}
});