美文网首页
UITableViewCell 图片大小 + 圆角

UITableViewCell 图片大小 + 圆角

作者: 九月oc | 来源:发表于2022-01-05 10:01 被阅读0次

 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();

相关文章

网友评论

      本文标题:UITableViewCell 图片大小 + 圆角

      本文链接:https://www.haomeiwen.com/subject/igshcrtx.html