Add cornerRadius property

This commit is contained in:
Gunay Mert Karadogan 2015-07-01 19:01:10 +02:00
parent 43199a72db
commit e87e41653d
2 changed files with 13 additions and 0 deletions

View File

@ -31,6 +31,9 @@
<userDefinedRuntimeAttribute type="number" keyPath="maximumValue">
<integer key="value" value="9"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="4"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
</subviews>

View File

@ -86,6 +86,13 @@ import UIKit
}
}
@IBInspectable public var cornerRadius: CGFloat = 4.0 {
didSet {
layer.cornerRadius = cornerRadius
clipsToBounds = true
}
}
private let leftButton = UIButton()
private let rightButton = UIButton()
private let label = UILabel()
@ -121,6 +128,9 @@ import UIKit
label.backgroundColor = labelBackgroundColor
label.font = labelFont
addSubview(label)
layer.cornerRadius = cornerRadius
clipsToBounds = true
}
public override func layoutSubviews() {