• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Creating a clock and updating a textfield
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Creating a clock and updating a textfield
      • From: Tom Harrington <email@hidden>
  • Prev by Date: Re: Predicate variable substitution
  • Next by Date: Re: Predicate variable substitution
  • Previous by thread: XML-RPC and Encoding
  • Next by thread: Re: Creating a clock and updating a textfield
  • Index(es):
    • Date
    • Thread