Set UIImageView image using a url

后端 未结 10 731
隐瞒了意图╮
隐瞒了意图╮ 2020-12-08 02:24

Is it possible to read a url to an image and set a UIImageView to the image at this url?

10条回答
  •  心在旅途
    2020-12-08 02:59

    NSString *ImageURL = @"YourURLHere";
    NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:ImageURL]];
    imageView.image = [UIImage imageWithData:imageData];
    

提交回复
热议问题