ios 用url获取图片的方法

    UIImageView *imgHeadView = [[UIImageView alloc]initWithFrame:CGRectMake(5, 5, 60, 60)];
    NSURL *url = [NSURL URLWithString:[[NSString alloc]initWithFormat:@"%@%@%@",nstrPublicUrl,@"/uploadfiles/",customerMgr.nsstrImgUrl]];
    NSData *data = [NSData dataWithContentsOfURL:url];
    UIImage *aimage = [[UIImage alloc] initWithData:data];  
    [imgHeadView setImage:aimage];
    [imgHeadView setNeedsDisplay];
    [aimage release];
    [tvCell addSubview:imgHeadView];

 

你可能感兴趣的:(ios)