Button圆角

{    
// 给moreBtn 设置圆角
//方式一
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.moreBtn.bounds
                                               byRoundingCorners:UIRectCornerBottomLeft |UIRectCornerTopLeft
                                                     cornerRadii:CGSizeMake(10, 10)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = self.moreBtn.bounds;
maskLayer.path = maskPath.CGPath;

self.moreBtn.layer.mask = maskLayer;

//方式二
    //初始化 获取验证码Button描边颜色 圆角 描边宽度
//        self.moreBtn.layer.cornerRadius = 10;
    self.moreBtn.layer.borderWidth = 2;
    self.moreBtn.layer.borderColor = ZKColor(248, 99, 133).CGColor;    
//     self.moreBtn.backgroundColor = [UIColor redColor];

[super layoutSubviews];

}

你可能感兴趣的:(Button圆角)