Drew017

macrumors 65816
Original poster
May 29, 2011
1,254
11
East coast, USA
Hello- I'm trying to make a window that simply displays the time and date in Cocoa. However, I just can't figure out how to do it! here's what I have so far...

Can anyone help? Thanks! :)

I'm using Xcode 3.1.4...
 

Attachments

  • MyClock 2.zip
    52.8 KB · Views: 93

gnasher729

Suspended
Nov 25, 2005
17,980
5,554
Hello- I'm trying to make a window that simply displays the time and date in Cocoa. However, I just can't figure out how to do it! here's what I have so far...

Do it step by step.

1. Create a window with a text field that displays let's say "21:10:05, 29 Jan 2012".

2. Change your code so that the text field displays the time and date when you application is started.

3. Change your code so that the text field changes its display every second.

After looking at your project, maybe you should look for tutorials at developer.apple.com first.
 
Comment

robvas

macrumors 68040
Mar 29, 2009
3,240
627
USA
Here you go. Now, look up NSTimer and make it update every second. And then look up drawing graphics and draw minute/hour hands.
 

Attachments

  • Clock.zip
    29.8 KB · Views: 133
Comment

robvas

macrumors 68040
Mar 29, 2009
3,240
627
USA
Take a look at the source code files, it should be pretty straightforward. Add a text field to your window and connect it to the 'timeOutput' delegate.
 
Comment
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.