I am loading a UIView from a .xib file like this:
static func loadFromNib() -> CardView {
let nib = UINib(nibName: "CardView", bundle: nil)
return nib.instantiate(withOwner: self, options: nil).first as! CardView
}
When loaded the view has the exact frame size as set in "Frame Rectangle" of the Size Inspector in the Interface Builder.
Is this guaranteed? I need this size to be exact, because subview constraints are specific and will not fit if the view has the wrong size [*], but I didn't find any mention of this in Apple's docs.
[*] = Reason: I am rendering the view to an UIImage so I can display it in and UIImageView later on. It shows the image of a membership card and name and membership number need to be in the right place with the correct font size on all devices..