I'm planning on making a stopwatch where the timer fires and then the text field updates by each second.

I read online that I should use NSTimeInterval for this, as well as NSDate, and NSTimer.

My main question is, how do you use NSTimeInterval?


NSTimeInterval is just a typedef for double:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_DataTypes/Reference/reference.html#/ /apple_ref/doc/c_ref/NSTimeInterval

There is nothing special you have to do. To create a timer that fires every second, you could do something like this:

[NSTimer scheduledTimerWithTimeInterval:1.
                                 target:self
                               selector:@selector(doSomething:)
                               userInfo:nil
                                repeats:YES];

-doSomething must have the following signature:

- (void)doSomething:(NSTimer *)theTimer

http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/Reference/NSTimer.html#/ /apple_ref/occ/clm/NSTimer/ scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:
_______________________________________________

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