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];

 

posted @ 2013-05-17 10:33  ygm900  阅读(1958)  评论(0编辑  收藏  举报