Lets say I have a custom control called FooBox. It is just a square on the screen. It has some properties like color, border, etc. When I change the properties, I want the FooBox to redraw itself to reflect its new properties. Is there a way to do that without writing custom setters and putting [self setNeedsDisplay:YES] into all of them?
I am not certain if this is the right way to do it, but you could consider using NSKeyValueObserving
and register the object as observer of itself, and do the redrawing in the -observeValueForKeyPath:ofObject:change:context:
method.
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