How to detect when UIView size is changed in swift ios xcode?
There's an answer here:
https://stackoverflow.com/a/27590915/5160929
Just paste this outside of a method body:
override var bounds: CGRect {
didSet {
// Do stuff here
}
}
viewWillLayoutSubviews()
and viewDidLayoutSubviews()
will be called whenever the bounds change. In the view controller.