天天看點

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;
}
           

繼續閱讀