Re: Observing changes in TableView


Alex Zavatone
 

Though in concept, I love the idea of KV observers, in practice, I’ve found that they lead to too many crashes.

I’ve switched over to sending notifications and it’s much less to worry about and much less wasted time. FWIW.

Alex Zavatone

On Nov 8, 2017, at 12:48 PM, Gerriet M. Denkmann <g@...> wrote:


On 9 Nov 2017, at 01:36, Quincey Morris <quinceymorris@...> wrote:

On Nov 8, 2017, at 01:47 , Gerriet M. Denkmann <g@...> wrote:

So I gave the Button a target and action, but this never results in a message sent.
This ought to work, so I think you should focus on finding out why it isn’t. What are you specifying for the target? It should be something that doesn’t depend on the cell itself, like the view controller or the app delegate.
It was the app delegate.

I found another solution:
The contentArray contains only a few dictionaries - less than a dozen.
So I decided to observe all of them:

for( NSDictionary *d in self.contentArray )
{
[ d addObserver: self
forKeyPath: kKeyPath // “Flag”
options: 0
context: (__bridge void * _Nullable)(kKeyPath)
];
};

Kind regards,

Gerriet.





Join {cocoa@apple-dev.groups.io to automatically receive all group messages.