这是我的代码
@IBDesignable class BarPopView: UIView {
@IBInspectable var ft: NSString = "1"
@IBInspectable var ffPrompt: NSString = "Area"
override init(frame: CGRect) {
super.init(frame: frame)
setupView()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setupView()
}
func setupView() {
print("text: \(ft), prompt: \(ffPrompt)")
}
}
我在界面生成器中设置了这些值
ft: 50 ffPrompt: "Change"
但结果是打印
“文本:1,提示:区域”