UIImage * icon = [UIImage imageNamed:@"user5"];
CGSizeitemSize =CGSizeMake(40,40);//固定图片大小为36*36
UIGraphicsBeginImageContextWithOptions(itemSize, NO, 0.0);//*1
CGRectimageRect =CGRectMake(0,0, itemSize.width, itemSize.height);
[icondrawInRect:imageRect];
cell.imageView.image = UIGraphicsGetImageFromCurrentImageContext();//*2
cell.imageView.clipsToBounds = YES;
cell.imageView.layer.cornerRadius = 10;
UIGraphicsEndImageContext();
网友评论