修改Designable类中的标签构建

时间:2018-07-16 23:55:07

标签: ios iphone swift xcode ibdesignable

是否可以修改在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。我该如何实现?我唯一的方法是在另一个类中构建标签?

感谢您的答复

0 个答案:

没有答案