Change UIButton BorderColor in Storyboard

后端 未结 7 1326
南笙
南笙 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:16

    In case of Swift, function doesn't work. You'll need a computed property to achieve the desired result:

    extension CALayer {
        var borderColorFromUIColor: UIColor {
            get {
                return UIColor(CGColor: self.borderColor!)
            } set {
                self.borderColor = newValue.CGColor
            }
        }
    }
    

提交回复
热议问题