是否可以修改在Designable类中创建的标签?
这在我的Designable课中:
@IBInspectable var textOfCutLabel: String = "test"{
didSet {
updateUpCutLabel()
}
}
...
if textOfCutLabel != nil {
let myAttributes = [
NSAttributedStringKey.font: UIFont(name: "Avenir-HeavyOblique", size: 15.0)! ,
NSAttributedStringKey.foregroundColor: UIColor.white
]
let myAttributedString = NSAttributedString(string: textOfCutLabel!, attributes: myAttributes )
textLayerRightLabel.string = myAttributedString
textLayerRightLabel.backgroundColor = UIColor.clear.cgColor
textLayerRightLabel.frame = CGRect(x: self.frame.size.width - width + textMarginRightUpLabel, y: 8, width: width, height: height)
self.layer.addSublayer(textLayerRightLabel)
}
我想在另一个类中修改此textLayerRightLabel
。我该如何实现?我唯一的方法是在另一个类中构建标签?
感谢您的答复