Re: Easier way to make NSView subclasses refresh on a property change?

2016-02-04 Thread Motti Shneor
>> On 3 Feb 2016, at 5:05 PM, Graham Cox > > wrote: >> >> Is there a good way to automate this for a given set of properties? > > > BTW, it would be really great if this were an extension of property > attributes, e.g: > > @property

Re: Easier way to make NSView subclasses refresh on a property change?

2016-02-03 Thread Keary Suska
> On Feb 2, 2016, at 11:05 PM, Graham Cox wrote: > > Hi all, > > Whenever I make a custom view class, it often has a bunch of properties that > affect the content it renders. So, for each setter that does this, I have to > override the setter, do whatever it normally

Re: Easier way to make NSView subclasses refresh on a property change?

2016-02-03 Thread Lee Ann Rucker
[self addObserver:self forKeyPaths:[Foo keyPathsThatAffectDisplay] ...context:SomeUniquePtrValue]; (We have a class addition to NSObject to take an array of keyPaths and lopp through addObserver:forKeyPath: etc, because we use multiple key paths *everywhere*) - (void)observeValueForKeyPath:

Re: Easier way to make NSView subclasses refresh on a property change?

2016-02-03 Thread Alex Zavatone
Set a key value observer for each that would call the refresh method. If there's a way to cluster them all into a collective set of things that would change (I think there may) I'm interested in hearing about it too. Would it be possible (or wise) to add them to an array or set and put the

Easier way to make NSView subclasses refresh on a property change?

2016-02-02 Thread Graham Cox
Hi all, Whenever I make a custom view class, it often has a bunch of properties that affect the content it renders. So, for each setter that does this, I have to override the setter, do whatever it normally does plus call -setNeedsDisplay:YES. This gets tedious. Is there a good way to

Re: Easier way to make NSView subclasses refresh on a property change?

2016-02-02 Thread Graham Cox
> On 3 Feb 2016, at 5:05 PM, Graham Cox wrote: > > Is there a good way to automate this for a given set of properties? BTW, it would be really great if this were an extension of property attributes, e.g: @property (nonatomic, assign, refresh) BOOL goesWild; Then