ios 用url获取图片的方法

╰+哭是因爲堅強的太久メ 2022-04-10 09:50 508阅读 0赞
  1. UIImageView *imgHeadView = [[UIImageView alloc]initWithFrame:CGRectMake(5, 5, 60, 60)];
  2. NSURL *url = [NSURL URLWithString:[[NSString alloc]initWithFormat:@"%@%@%@",nstrPublicUrl,@"/uploadfiles/",customerMgr.nsstrImgUrl]];
  3. NSData *data = [NSData dataWithContentsOfURL:url];
  4. UIImage *aimage = [[UIImage alloc] initWithData:data];
  5. [imgHeadView setImage:aimage];
  6. [imgHeadView setNeedsDisplay];
  7. [aimage release];
  8. [tvCell addSubview:imgHeadView];

发表评论

表情:
评论列表 (有 0 条评论,508人围观)

还没有评论,来说两句吧...

相关阅读