Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?
Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?
- Subject: Re: KVO Question: How to programmatically determine if one object is observing another on a keyPath and context?
- From: James Montgomerie <email@hidden>
- Date: Mon, 10 Sep 2012 12:23:47 +0100
On 10 Sep 2012, at 11:40, Motti Shneor <email@hidden> wrote:
> My question is general. Supposedly I could NOT start observing once, and stop it once. Reasons:
> 1. There are many instances of that NSViewController
> 2. This observation is quite frequent in time (could reach 100 times a second)
> 3. The code to filter-out unwanted value-changes is CPU intensive. (Accounting for 5 orthogonal conditions, upon which I should actually do something with the attribute change)
Does your view controller need to be aware of all these changes? 100s of changes a second is faster than your display can operate so, if this code is just to keep your UI up to date, there's potentially a lot of redundant work going on.
Is it possible that you could, instead of observing, do something simpler like poll for changes while whatever's causing them to happen is underway? For example, could you use an NSTimer firing once every 30th or 15th of a second, calling a method that updates the UI? This would avoid the overhead of processing all those 100s of changes per second in the view controller.
Jamie.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden