给按钮加圆角边框

#import 

@interface CALayer (BtnBorderColor)

@property(nonatomic, assign) UIColor *borderUIColor;

@end

#import "CALayer+BtnBorderColor.h"

@implementation CALayer (BtnBorderColor)

-(void)setBorderUIColor:(UIColor*)color
{
    
    self.borderColor = color.CGColor;
    
}

-(UIColor*)borderUIColor
{
    
    return [UIColor colorWithCGColor:self.borderColor];
    
}

@end

使用

设置圆角:Key Path:layer.borderWidth Type:Number Value:1
设置边框宽度:Key Path:layer.cornerRadius Type:Number Value:8
设置边框的颜色:Key Path:layer.borderColor Type:Color Value:自己选

你可能感兴趣的:(给按钮加圆角边框)