天天看点

ios 修改单边圆角

_checkOrderDetailBtn.layer.mask = [TFGoodsUtils setButtoncornerRadius:UIRectCornerBottomLeft
                                                      Btn:_checkOrderDetailBtn
                                             cornerRadius:8.0];
           
/**
 *  返回layer的层
 *
 *  @param corners 想修改btn的某一个角   UIRectCornerTopLeft:左上角
    @param btn  当前想修改的button
    @param cornerRadius 圆角大小
 *
 *  @return layer
 */
           
+ (CAShapeLayer*)setButtoncornerRadius:(UIRectCorner)corners
                                   Btn:(UIButton*)btn
                          cornerRadius:(float)cornerRadius
{
    [btn.layer setMasksToBounds:YES];
    CAShapeLayer *maskLayer = [CAShapeLayer layer];
    maskLayer.path = [UIBezierPath bezierPathWithRoundedRect:btn.bounds byRoundingCorners: corners cornerRadii: (CGSize){cornerRadius, cornerRadius}].CGPath;
    
    
    return maskLayer;
}
           

继续阅读