setNeedsLayout and setNeedsDisplay

被刻印的时光 ゝ 提交于 2019-11-26 11:59:44

问题


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

As usual documentation is foggy about this.


回答1:


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.



来源:https://stackoverflow.com/questions/14506968/setneedslayout-and-setneedsdisplay

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!