Creating a clock and updating a textfield
Creating a clock and updating a textfield
- Subject: Creating a clock and updating a textfield
- From: Nima <email@hidden>
- Date: Sat, 29 Oct 2005 23:28:07 +0100
Hi
I'm trying to make a simple clock which is generated in a text field by
clicking a button.
//This code is supposed to trigger the clock
NSDate *today = [NSDate date];
[showTime setStringValue:today];
While it does generate the current date and time, it fails to update it -
and here's where my Obj-C experience fails me.
How do I go about to update the textfield?
I did some research and found out that one way to do it is by implementing
this code:
//from http://www.cocoabuilder.com/archive/message/cocoa/2003/7/7/3275
NSTimer *timer = [[NSTimer alloc] initWithFireDate:startTime
interval:1.0 target:self selector:@selector(update:) userInfo:nil
repeats:YES];
But since I'm a Obj-C beginner I'm having a hard time using it in my own
little application.
Can someone give me a couple of pointers on how this specific task is to be
dealt with?
Best regards
_______________________________________________
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