• 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: Progress bar jitters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Progress bar jitters


  • Subject: Re: Progress bar jitters
  • From: Nick Zitzmann <email@hidden>
  • Date: Thu, 24 Aug 2006 15:40:35 -0600


On Aug 24, 2006, at 2:39 PM, Trygve Inda wrote:

In the Apple sample code, QTKitProgressTester, why does the progress bar
jitter... That is it goes up some, then jumps back?

There's a bug in NSProgressIndicator where very small updates cause the bar to become jumpy. We worked around the problem by doing this, assuming you set the indicator's maximum to 1.0 and you're pushing a percentage: (warning - written in Mail, untested, use at your own risk, etc.)


int iterator;
int count = (maximum number here);
double countf = count;
double lastProgressValuef = 0.0;

for (well, you know...)
{
	double iterationsf = iterator;
	int percentAsInt = (iterationsf/countf)*200.0;
	double modifiedProgressValuef = percentAsInt/200.0;

	// do your work, then...
	if (modifiedProgressValuef != lastProgressValuef)
	{
		lastProgressValuef = modifiedProgressValuef;
		[yourProgressIndicator setValue:modifiedProgressValuef];
	}
}

Nick Zitzmann
<http://www.chronosnet.com/>


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Progress bar jitters (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: Controlling participation in the keyView loop?
  • Next by Date: Re: Non-ASCII NSTask arguments
  • Previous by thread: Re: Progress bar jitters
  • Next by thread: Objects In Nibs Losing Settings
  • Index(es):
    • Date
    • Thread