How to force layoutSubviews of UIView?

Had a similar problem today. I solved it by first calling

  • -setNeedsLayout: Set the flag that the view needs layout, and afterwards calling
  • -layoutIfNeeded: Check the flag immediately and – as it was set manually before – as result layoutSubviews is called.

Don’t know if this is the best way, but it works 😉

Leave a Comment