Re: Is slowing down bindings updates possible?
Re: Is slowing down bindings updates possible?
- Subject: Re: Is slowing down bindings updates possible?
- From: Kyle Sluder <email@hidden>
- Date: Sat, 14 Jan 2012 09:37:21 -0800
On Jan 14, 2012, at 2:53 AM, Marcel Weiher <email@hidden> wrote:
> Hi Andrew,
>
> On Jan 13, 2012, at 6:57 , Andrew wrote:
>
>> The result of this is that the UI updates really frequently and the
>> estimated time to complete and the download rate jump around a lot. I
>> would love it if I could tell cocoa to only update the UI once per
>> second instead of immediately when the property key changes.
>
> You shouldn't push updates to the UI, the UI should query the model, and it should do it at "human speed", not at whatever speed the machine can manage to change the state. There are a bunch of reasons for this, not least is that UI updating is fairly heavyweight and you can actually impact your performance (significantly, in some cases).
Be careful here. This is good advice in this particular circumstance, but in general pushing values to the UI is good and common design. The UI will register as a KVO observer, or as an NSNotification observer, or perhaps the controller will just call -setObjectValue: directly.
Breaking this pattern should be a conscious decision. For example, you don't push a value to cell-based NSTableViews; you tell the table view it needs to ask you for the values at certain indexes. This is because cell-based table views are an optimization that avoids keeping tons of view objects around.
But view-based table views behave just like any other view: you push updates directly to the controls contained within your table cell view.
In Andrew's case, it's clear that he should deviate from the norm, and the UI should be in charge of asking for the latest value at a rate that makes sense, probably controlled by an NSTimer.
--Kyle Sluder_______________________________________________
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