• 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
Is slowing down bindings updates possible?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is slowing down bindings updates possible?


  • Subject: Is slowing down bindings updates possible?
  • From: Andrew <email@hidden>
  • Date: Thu, 12 Jan 2012 22:57:37 -0700

I have a download controller with an NSMutableArray and an
NSArrayController hooked up to a NSTableView with a view based setup.
My array contains custom download objects. Each of those has a
NSURLDownload instance.

Basically, I am showing a browser-download like interface with size
downloaded, total expected size, a progress bar, time elapsed,
download rate and estimated time left.

It is all working wonderfully, but actually too well. Right now, I am
using will/didChangeValueForKey messages to notify observers when the
number of bytes downloaded changes. I am doing this in the callback
method:

- (void)download:(NSURLDownload *)download
didReceiveDataOfLength:(NSUInteger)length
{
  [self willChangeValueForKey:@"bytesDownloaded"];
  _bytesDownloaded += length;
  [self didChangeValueForKey:@"bytesDownloaded"];
}

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.

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.

Any other brighter ideas? Thoughts?

Thank you,
Andrew
_______________________________________________

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

  • Follow-Ups:
    • Re: Is slowing down bindings updates possible?
      • From: Marcel Weiher <email@hidden>
    • Re: Is slowing down bindings updates possible?
      • From: Steve Christensen <email@hidden>
    • Re: Is slowing down bindings updates possible?
      • From: Keary Suska <email@hidden>
    • Re: Is slowing down bindings updates possible?
      • From: Wade Tregaskis <email@hidden>
  • Prev by Date: Re: What makes OS X generate a hang report?
  • Next by Date: Re: checking if directory is writable
  • Previous by thread: Adding NSControl to IKImageBrowserCell
  • Next by thread: Re: Is slowing down bindings updates possible?
  • Index(es):
    • Date
    • Thread