I have a standard UIView added via IB which changes size based on orientation using constraints. Programatically I add a custom component (sub-classing UIView) to this view which by default is the sam size as its parent view. Problem is, how do I get my custom view (programatically added) to update its size based to match its parent when the parents size changes (due to orientation change)?
@IBOutlet weak var cardView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
let frame = cardView.bounds
// Custom component sub classes UI View
// Should always be same size as its parent
let imageTemplateView: ImageTemplateView = ImageTemplateView(frame: frame)
cardView.addSubview(imageTemplateView)
}