PDA

View Full Version : Xcode clock




Drew017
Jan 29, 2012, 04:47 PM
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...



gnasher729
Jan 29, 2012, 05:30 PM
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
Jan 30, 2012, 09:53 AM
Here you go. Now, look up NSTimer and make it update every second. And then look up drawing graphics and draw minute/hour hands.

Drew017
Jan 30, 2012, 02:10 PM
Here you go. Now, look up NSTimer and make it update every second. And then look up drawing graphics and draw minute/hour hands.

Thank you, but it won't open on Xcode 3.1.4 on leopard.

robvas
Jan 30, 2012, 03:01 PM
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.

Drew017
Jan 30, 2012, 03:02 PM
alright... thank you!