ibinspectable

Corner radius not showing on button in storyboard with @IBDesigable/@IBInspectable

那年仲夏 提交于 2019-11-29 11:35:46
I have this custom class for a button. import UIKit @IBDesignable class CustomButton: UIButton { @IBInspectable var cornerRadiusValue: CGFloat = 10.0 { didSet { setUpView() } } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) self.layer.cornerRadius = 10.0 } override func awakeFromNib() { setUpView() } override func prepareForInterfaceBuilder() { super.prepareForInterfaceBuilder() setUpView() } func setUpView() { self.layer.cornerRadius = 10.0 } } But the corner radius is not showing on the button in the storyboard. I understand @IBInspectable just allows you to change the

Corner radius not showing on button in storyboard with @IBDesigable/@IBInspectable

不羁岁月 提交于 2019-11-28 05:04:22
问题 I have this custom class for a button. import UIKit @IBDesignable class CustomButton: UIButton { @IBInspectable var cornerRadiusValue: CGFloat = 10.0 { didSet { setUpView() } } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) self.layer.cornerRadius = 10.0 } override func awakeFromNib() { setUpView() } override func prepareForInterfaceBuilder() { super.prepareForInterfaceBuilder() setUpView() } func setUpView() { self.layer.cornerRadius = 10.0 } } But the corner radius is

IB_DESIGNABLE, IBInspectable — Interface builder does not update

[亡魂溺海] 提交于 2019-11-27 03:21:40
I have the following set of code: CustomView.h #import <UIKit/UIKit.h> IB_DESIGNABLE @interface CustomView : UIView @property (nonatomic) IBInspectable UIColor *borderColor; @property (nonatomic) IBInspectable CGFloat borderWidth; @property (nonatomic) IBInspectable CGFloat cornerRadius; @end CustomView.m #import "CustomView.h" @implementation CustomView - (void)setBorderColor:(UIColor *)borderColor { _borderColor = borderColor; self.layer.borderColor = borderColor.CGColor; } - (void)setBorderWidth:(CGFloat)borderWidth { _borderWidth = borderWidth; self.layer.borderWidth = borderWidth; } -

IB_DESIGNABLE, IBInspectable — Interface builder does not update

邮差的信 提交于 2019-11-26 10:27:17
问题 I have the following set of code: CustomView.h #import <UIKit/UIKit.h> IB_DESIGNABLE @interface CustomView : UIView @property (nonatomic) IBInspectable UIColor *borderColor; @property (nonatomic) IBInspectable CGFloat borderWidth; @property (nonatomic) IBInspectable CGFloat cornerRadius; @end CustomView.m #import \"CustomView.h\" @implementation CustomView - (void)setBorderColor:(UIColor *)borderColor { _borderColor = borderColor; self.layer.borderColor = borderColor.CGColor; } - (void