Re: Displaying time
Re: Displaying time
- Subject: Re: Displaying time
- From: Gregory Weston <email@hidden>
- Date: Fri, 22 Aug 2008 08:38:19 -0400
Ron Fleckner wrote:
I want to display the current time in a full screen window. I'm
making my computer into a digital clock (for my own use). I've done
it by using NSCalendarDate and extracting the hours, minutes, and
seconds, formatting a string and displaying it. I use an NSTimer to
update the display every half a second.
My question is: Is there a better way to display what is essentially
the same as the menu bar clock?
The menu bar uses the user's specified short date format, potentially
adjusting for its own settings by controlling whether or not the
string starts with the day-of-week and/or ends with AM/PM indicator.
I think the quickest route to get close to that is to use an
NSDateFormatter with the time style set to NSDateFormatterShortStyle
and the date style set to NSDateFormatterNoStyle. If you want to do
the same fiddling that the menu bar does, you'll have to retrieve the
actual format string from NSUserDefaults and tweak it ahead of time.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden