Mac Xcode clock

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

gnasher729

macrumors P6
Nov 25, 2005
17,123
4,146
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.
 

robvas

macrumors 68040
Mar 29, 2009
3,202
611
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

robvas

macrumors 68040
Mar 29, 2009
3,202
611
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.