Mustafa
Mustafa

Reputation: 20564

Cocoa: Time Picker

Is there a generic control for picking and selecting time for Cocoa application (Mac Application Development)? For example, consider the case of a stop watch. The watch starts from 00:00:00.

The NSDatePicker seem to support "00:00:00 AM/PM" format only. I don't want "AM/PM", instead i want the control to support milliseconds e.g. "00:00:00,000". I may have to use set of NSTextFields alongside NSStepper controls, but a better solution (if available) would be preferred.

Upvotes: 2

Views: 1880

Answers (1)

Nicholas Riley
Nicholas Riley

Reputation: 44321

You're right, NSDatePicker isn't customizable for milliseconds, and in any case it's not designed to show relative time, it's designed to show absolute time.

If you're happy to limit your stopwatch to 24 hours, then you can use a NSTextField with an attached NSDateFormatter with a format string of HH:mm:ss,SSS. Otherwise, you're on your own.

Upvotes: 1

Related Questions