官方文档:
- (void)setNeedsDisplay | |
| Marks the receiver’s entire bounds rectangle as needing to be redrawn. |
| You can use this method or the setNeedsDisplayInRect: to notify the system that your view’s contents need to be redrawn. This method makes a note of the request and returns immediately. The view is not actually redrawn until the next drawing cycle, at which point all invalidated views are updated. Note If your view is backed by a CAEAGLLayer object, this method has no effect. It is intended for use only with views that use native drawing technologies (such as UIKit and Core Graphics) to render their content. You should use this method to request that a view be redrawn only when the content or appearance of the view change. If you simply change the geometry of the view, the view is typically not redrawn. Instead, its existing content is adjusted based on the value in the view’s contentMode property. Redisplaying the existing content improves performance by avoiding the need to redraw content that has not changed. |
1、异步,该更新间隙让你去废弃无效的视图(all invalidated views are updated)。
2、CAEAGLLayer 无效,这里要注意GLKView。
3、UIView的内容或者外观发生改变建议调用
4、调用后已存在的内容回根据 contentMode 属性自适应
5、不要重画没有改变的内容