自定义网络请求图片的大小

来源:互联网 发布:suse防火墙开放端口 编辑:程序博客网 时间:2024/06/06 01:21

NSURL *url = [NSURL URLWithString:[[self.imageSource objectAtIndex:indexPath.section] objectAtIndex:indexPath.row]];
UIImage *icon = [UIImage imageWithData:[NSData dataWithContentsOfURL:url]];CGSize itemSize = CGSizeMake(30, 30); UIGraphicsBeginImageContextWithOptions(itemSize,NO,0.0); 
CGRect imageRect =CGRectMake(0.0,0.0, itemSize.width, itemSize.height); 
 [icon drawInRect:imageRect];
 cell.imageView.image =UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();
0 0