I have a nib/xib
file with several Labels
. Each label should obviously have a different text, but should all look the same. I therefore create a (very simple) CustomLabel
class that inherits from UILabel:
import UIKit
class CustomLabel: UILabel {
override init(frame: CGRect) {
super.init(frame: frame)
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.layer.cornerRadius = self.frame.size.width/2.0
self.layer.backgroundColor = UIColor.blueColor().CGColor
}
}
I then click on each label in Interface Builder and set each custom class to this "CustomLabel", but nothing is changing when I compile.
How do I correctly create and link custom elements?