Creating a Clock??

Discussion in 'Mac Programming' started by Fritzables, Sep 30, 2011.

  1. Fritzables macrumors regular

    Joined:
    May 6, 2011
    Location:
    Brisbane AUSTRALIA
    #1
    G'Day To All,

    I want to write a logging utility to keep track of contacts I make using Ham radio using Xcode and supporting Mac.

    The requirement will to have a digital clock placed in one of the panes. This is to read system time converted to UTC.

    I am guessing I use NSDate as the object??

    Lastly, I assume that code need to be written so that the clock I create stays in a loop so it continually updates. Typically, where would one place such a loop?

    Pete
     
  2. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #2
    Quickly before the final quarter of the AFL grand final starts.... :)

    You can use either the trio of NSDate/NSCalendar/NSDateComponents or the duo of NSDate/NSDateFormatter depending on how you implements your clock view. See the Date and Time Programming Guide.

    Running loops is an anti-pattern in event-driven programming like Cocoa. Instead use an NSTimer to invoke a method that updates the clock view at intervals. See the Timer Programming Topics.
     
  3. Fritzables thread starter macrumors regular

    Joined:
    May 6, 2011
    Location:
    Brisbane AUSTRALIA
    #3
    G'Day Jimi,

    Just catching the end of it now - I heard that it was a pretty close game. Eddie doesn't look happy so I guess Geelong won.

    As long as Manly get their arsses kicked tomorrow.... that's all that matters !!

    Thanks for the assistance.

    Pete
     

Share This Page