美文网首页
为cell设计(画)圆角

为cell设计(画)圆角

作者: 乐乐的熊 | 来源:发表于2018-11-07 17:13 被阅读1次

    https://www.jianshu.com/p/2df0ea05c005

    - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
        CGFloat cellWidth =cell.width;
        CGFloat cellHeight = cell.height;
        CAShapeLayer *maskLayer = [CAShapeLayer layer];
        maskLayer.frame = CGRectMake(0, 0, cellWidth, cellHeight);
        
        CGFloat cornerRadius =5;
        UIBezierPath *bezierPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, cellWidth, cellHeight) cornerRadius:cornerRadius];
        maskLayer.path = bezierPath.CGPath;
        [cell.layer setMask:maskLayer];
        
    }
    

    相关文章

      网友评论

          本文标题:为cell设计(画)圆角

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