Re: while loop with sleep(): logging works, but not UI events
Re: while loop with sleep(): logging works, but not UI events
- Subject: Re: while loop with sleep(): logging works, but not UI events
- From: "Michael Ash" <email@hidden>
- Date: Sat, 28 Jun 2008 10:58:05 -0400
On Sat, Jun 28, 2008 at 12:10 AM, Shawn Erickson <email@hidden> wrote:
> Also you should fire your timer every
> 0.75 of seconds (or so) to ensure your UI update is consistent/smooth.
> Firing every second may cause your timer to fire a little after 1
> second later so your UI could skip from say 50s to 52s.
I do not recommend this, as using 0.75s will guarantee a jittery
update. Consider what happens when you start at 0 and round down to
figure out what to display. You'll display 0, then 0 again. Then
you'll display 1, at 1.5 seconds after start, then 2 and 3 each 0.75
seconds after the previous number. The cycle repeats with 4, which
displays 1.5 seconds after 3.
Firing once a second is usually just fine, so if you want to keep
things simple, do that. To ensure against skipping, round to the
nearest integer, which will ensure that you can be off by up to .5
seconds without skipping any numbers.
Mike
_______________________________________________
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