setNeedsLayout和setNeedsDisplay [英] setNeedsLayout and setNeedsDisplay
本文介绍了setNeedsLayout和setNeedsDisplay的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
UIView
方法 setNeedsLayout
和 setNeedsDisplay $ c之间的真正区别是什么? $ c>?
像往常一样,文件很模糊。
As usual documentation is foggy about this.
推荐答案
实际上文档很清楚:
-
setNeedsLayout 将布局子视图
当你想调整视图子视图的布局时,在应用程序的主线程上调用此方法。
Call this method on your application’s main thread when you want to adjust the layout of a view’s subviews.
setNeedsDisplay 将要求重新绘制您的视图( drawRect:
等) 。
setNeedsDisplay will call for a redraw of your view (drawRect:
, etc).
您可以使用此方法或setNeedsDisplayInRect:来通知系统您的视图内容需要重绘。
You can use this method or the setNeedsDisplayInRect: to notify the system that your view’s contents need to be redrawn.
这篇关于setNeedsLayout和setNeedsDisplay的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文