方法一:直接使用UIView对应图层的cornerRadius

        self.layer.cornerRadius     = CGRectGetWidth(self.bounds)/2.f;

        self.clipsToBounds          = YES;

方法二:使用图层遮罩

    CAShapeLayer* mask = [CAShapeLayer layer];

        CGFloat width = self.frame.size.width;

        UIBezierPath* path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(width/2,width/2)  radius:width /2 startAngle:0 endAngle:2*M_PI clockwise:YES];

        mask.path = path.CGPath;

        self.layer.mask = mask;

相关文章:

  • 2021-08-28
  • 2021-08-04
  • 2022-12-23
  • 2021-05-02
  • 2021-12-28
  • 2021-10-27
猜你喜欢
  • 2021-11-22
  • 2021-04-11
  • 2022-12-23
  • 2021-12-29
  • 2021-07-05
  • 2022-12-23
相关资源
相似解决方案