• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Is slowing down bindings updates possible?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is slowing down bindings updates possible?


  • Subject: Re: Is slowing down bindings updates possible?
  • From: Wade Tregaskis <email@hidden>
  • Date: Thu, 12 Jan 2012 22:30:08 -0800

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

References: 
 >Is slowing down bindings updates possible? (From: Andrew <email@hidden>)

  • Prev by Date: Re: checking if directory is writable
  • Next by Date: Re: Messed up UTIs in NSDocument-based application
  • Previous by thread: Is slowing down bindings updates possible?
  • Next by thread: Re: Is slowing down bindings updates possible?
  • Index(es):
    • Date
    • Thread