Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Creating a clock and updating a textfield



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.