I have a bunch of same labels and created UILabel subclass to customise them. But changes made in CustomizedLabel are not applied to labels in view controller. Here is my code:
import UIKit
class CustomizedLabel: UILabel {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
commonInit()
}
override init(frame: CGRect) {
super.init(frame: frame)
commonInit()
}
func commonInit(){
layer.cornerRadius = 10
textColor = UIColor.green
layer.borderColor = UIColor.green.cgColor
layer.borderWidth = 1
}
}
And view:
import UIKit
class StatiscticsScreenViewController: UIViewController {
@IBOutlet weak var threeSymbTimeRecordLabel: CustomizedLabel!
@IBOutlet weak var fourSymbTimeRecordLabel: CustomizedLabel!
@IBOutlet weak var fiveSymbTimeRecordLabel: CustomizedLabel!
@IBOutlet weak var sixSymbTimeRecordLabel: CustomizedLabel!
@IBOutlet weak var sevenSymbTimeRecordLabel: CustomizedLabel!
@IBOutlet weak var ThreeSymbMovesRecordLabel: CustomizedLabel!
@IBOutlet weak var FourSymbMovesRecordLabel: CustomizedLabel!
@IBOutlet weak var FiveSymbMovesRecordLabel: CustomizedLabel!
@IBOutlet weak var SixSymbMovesRecordLabel: CustomizedLabel!
@IBOutlet weak var SevenSymbMovesRecordLabel: CustomizedLabel!
...
Unfortunately for now I don't have possibility for voting for comment but first comment from Cristik actually helped me. I just forgot to change class on Storybord