> 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.

I don't believe there is such a feature.  Though I wouldn't be surprised if 
someone out there has already implemented a proxy like you suggest.

> With a bit of work I could probably set up a proxy object for each
> download that would do something like that and use timer, but it would
> be a lot of messy code. I could also just delay updating the
> _bytesDownloaded on a queue. Or a third idea is to cache the estimated
> calc time and rate and then only recalculate the value at most once
> per second.


I think if you're going to follow the MVC paradigm, you should be sure to 
update _bytesDownloaded immediately - that's your model, which should always be 
accurate.  Any smoothing or aggregation or whatever else you want for UI 
purposes should be handled in your controller.

So, either a reusable proxy object (if you'd like to stick with bindings), or 
just coded in your controller such that it won't update the view at more than N 
Hz (in which case simply modifying the UI "manually" from your controller is 
probably the easiest option).

Either way the implementation shouldn't be that tricky - just a timer and a 
last-updated timestamp.
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to