Xcode clock

Discussion in 'Mac Programming' started by Drew017, Jan 29, 2012.

  1. macrumors 65816

    Drew017

    Joined:
    May 29, 2011
    Location:
    East coast, USA
    #1
    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...
     

    Attached Files:

  2. macrumors G5

    gnasher729

    Joined:
    Nov 25, 2005
    #2
    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.
     
  3. macrumors 68000

    Joined:
    Mar 29, 2009
    Location:
    USA
    #3
    Here you go. Now, look up NSTimer and make it update every second. And then look up drawing graphics and draw minute/hour hands.
     

    Attached Files:

  4. thread starter macrumors 65816

    Drew017

    Joined:
    May 29, 2011
    Location:
    East coast, USA
    #4
    Thank you, but it won't open on Xcode 3.1.4 on leopard.
     
  5. macrumors 68000

    Joined:
    Mar 29, 2009
    Location:
    USA
    #5
    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.
     
  6. thread starter macrumors 65816

    Drew017

    Joined:
    May 29, 2011
    Location:
    East coast, USA
    #6
    alright... thank you!
     

Share This Page