[英]NSView - how can i redraw a subview without redrawing the parent view
I have a NSView with a sub view.我有一个带有子视图的 NSView。 I want to be able to redraw the sub view (call its drawRect) without redrawing the parent view.我希望能够在不重绘父视图的情况下重绘子视图(调用它的 drawRect)。 Is that possible?那可能吗?
When i case setNeedsDisplay on he sub view, drawRect of the parent view also called.当我在子视图上设置 setNeedsDisplay 时,也会调用父视图的 drawRect。
One thing you can do to reduce unnecessary drawing is overide -isOpaque
and return YES.减少不必要的绘图可以做的一件事是覆盖-isOpaque
并返回 YES。
Of course, you should only do this if the subview is in fact opaque.当然,只有当子视图实际上是不透明的时才应该这样做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.