我有一个UIView
就是@IBDesignable
@IBDesignable
class MyView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
sharedInit()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
sharedInit()
}
private func sharedInit(){
translatesAutoresizingMaskIntoConstraints = false
backgroundColor = .blue
}
}
当我将这个 aUIView
放在 Storyboard 中,并将它的类分配给MyView
Identity inspector时,它UIView
仍然有一个默认的背景颜色。为什么它的背景颜色不在UIColor.blue
情节提要中?而且,请问我怎样才能做到这一点?
谢谢你的帮助。