In Cocoa, when we want to redraw a view, we would send the view a setNeedsDisplay:
message telling the view to redraw itself with a parameter of YES. I was wondering if there are any circumstances where you would want to send a view setNeedsDisplay:NO
, such as multithreading environments, and if sending a view a setNeedsDisplay:YES
, then setting it again immediately after with setNeedsDisplay:NO
would make the view redraw itself. If there are no reasons to call setNeedsDisplay:NO
, then why create such a tedious method, where they could instead implement something like [view redrawView]
setNeedsDisplay:NO
may be used in case you want to discard previously called setNeedsDisplay:YES
. E.g. sometimes it is easier to mark all subviews as needing display and then run an algorithm to unmark some of them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With