Change UIButton BorderColor in Storyboard

后端 未结 7 1333
南笙
南笙 2020-12-12 14:31

I Set CornerRadius and BorderWidth for UIbutton in User Defined Runtime Attributes. Without adding layer.borderColor it works Well and Display border in bla

7条回答
  •  無奈伤痛
    2020-12-12 15:21

    I got answer. Change borderColor instead of layer.borderColor:

    Xcode snippet

    and add this code in .m file:

    #import 
    @implementation CALayer (Additions)
    
    - (void)setBorderColorFromUIColor:(UIColor *)color
    {
        self.borderColor = color.CGColor;
    }
    
    @end
    

    Tick properties in Attribute Inspector

    Attribute Inspector

提交回复
热议问题