Я хочу установить угловой радиус UITextView
по интерфейсу. Но я не в состоянии сделать это. Этот код работает нормально для UILabel
, UIButton
, но выдает ошибку в UITextView
.
class MyText: UITextView {
@IBInspectable var borderColor: UIColor = UIColor.whiteColor() {
didSet {
layer.borderColor = borderColor.CGColor
}
}
@IBInspectable var borderWidth: CGFloat = 1.0 {
didSet {
layer.borderWidth = borderWidth
}
}
@IBInspectable var cornurRadius: CGFloat = 1.0 {
didSet {
layer.cornerRadius = cornurRadius
clipsToBounds = true
}
}
//MARK: Initializers
override init(frame : CGRect) {
super.init(frame : frame)
setup()
configure()
}
convenience init() {
self.init(frame:CGRectZero)
setup()
configure()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setup()
configure()
}
override func awakeFromNib() {
super.awakeFromNib()
setup()
configure()
}
override func prepareForInterfaceBuilder() {
super.prepareForInterfaceBuilder()
setup()
configure()
}
func setup() {
layer.borderColor = UIColor.whiteColor().CGColor
layer.borderWidth = 1.0
layer.cornerRadius = 1.0
}
func configure() {
layer.borderColor = borderColor.CGColor
layer.borderWidth = borderWidth
layer.cornerRadius = cornurRadius
}
override func layoutSubviews() {
super.layoutSubviews()
}
}
clipsToBounds = true
- person Mohammad Zaid Pathan   schedule 24.10.2016@IBDesignable
выше объявления класса - person Bhavin Ramani   schedule 24.10.2016