I test a very simple thing:
I have a Subclassed UIView as follow:
@IBDesignable
class myView: UIView {
override public init(frame: CGRect) {
super.init(frame: frame)
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override open func layoutSubviews() {
super.layoutSubviews()
layer.frame.size.height = 50
layer.borderWidth = 1
layer.borderColor = UIColor.green.cgColor
}
}
To install this component in Interface Builder, I add an UIView and I change the class name in the Inspector.
When I add the UIView, the height of this view is 128. I suppose it is a default value of IB. But I want this height to be 50.
When I change the name of the class in the IB inspector, the view is correctly drawn, white a height of 50, but when I select it, the size of the selection is the size of a default UIView
Is there a mean to correct this?