- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
[.......];
CGSize itemSize = CGSizeMake(40, 40);
UIGraphicsBeginImageContextWithOptions(itemSize, NO, UIScreen.mainScreen.scale);
CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height);
[cell.imageView.image drawInRect:imageRect];
cell.imageView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[.......];
returen cell;
}
本文详细介绍了在iOS开发中如何使用UIGraphicsBeginImageContextWithOptions和UIGraphicsGetImageFromCurrentImageContext方法自定义绘制UITableViewCell的图片,包括设置图片大小、开始绘图上下文、绘制图片到指定矩形以及结束绘图上下文的过程。
235

被折叠的 条评论
为什么被折叠?



