On Fri, Jun 27, 2008 at 8:59 PM, Shawn Erickson <[EMAIL PROTECTED]> wrote:
> On Fri, Jun 27, 2008 at 8:55 PM, Daniel Richman
> <[EMAIL PROTECTED]> wrote:
>> Hi All,
>>
>> I'm trying to program a simple timer app: you enter a number of seconds, and
>> it updates a text field every second with the number of secs remaining. The
>> problem is that I'm not able to do anything with the UI while this is going
>> on. Here's my code:
>
> Look at using NSTimer to trigger a callback that will allow you to
> update UI as needed.

As Stephen noted... you need record the start time (or record the end
time) then check current time (look at NSDate) to ensure you count out
the requested amount of time. 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.

-Shawn
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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