iOS圆角 发表于 2020-07-13 | 分类于 iOS 12self.btn.layer.masksToBounds=YES;self.btn.layer.cornerRadius=self.btn.frame.size.width/2.0; 或 12345UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.btn.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(self.btn.frame.size.width/2.0, self.btn.frame.size.width/2.0)];CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];maskLayer.frame = self.btn.bounds;maskLayer.path = maskPath.CGPath;self.btn.layer.mask = maskLayer;