CGSize itemSize = CGSizeMake(, ); UIGraphicsBeginImageContextWithOptions(itemSize, NO,0.0); CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height); [icon drawInRect:imageRect]; cell.imageView.image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();
这里将imageView的大小设为40*40的。