setNeedsLayout and setNeedsDisplay

前端 未结 1 1136
被撕碎了的回忆
被撕碎了的回忆 2020-11-30 21:31

What is the real difference between UIView methods setNeedsLayout and setNeedsDisplay?

As usual documentation is foggy about t

相关标签:
1条回答
  • 2020-11-30 22:36

    Actually the documentation is pretty clear about this:

    • setNeedsLayout will layout subviews

      Call this method on your application’s main thread when you want to adjust the layout of a view’s subviews.

    • setNeedsDisplay will call for a redraw of your view (drawRect:, etc).

      You can use this method or the setNeedsDisplayInRect: to notify the system that your view’s contents need to be redrawn.

    0 讨论(0)
提交回复
热议问题