Wednesday, April 20, 2011

Best route to creating a Calendar based Date picker for Cocoa?

I'd like to implement a date picker using a calendar. Before I go ahead and try to build one, is there something that does this already?

I've looked at the date picker in Interface Builder and it's pretty much just a text field as far as I can tell. And looking (albeit quickly) through the developer docs, it seems there's plenty of date related functionality available, but not very much in the way of an interface. So If I do go ahead and build my own, what's the best line of attack

I've already built what i need in HTML/CSS and Javascript with jQuery for a website I'm working on, so my initial thought was that I could use a web view and display that, assuming there's some way to detect events happening inside a web view. But this feels a bit cheap to me. What would be the recommended route?

thanks

-G

From stackoverflow
  • Use NSDatePicker. You can change it to be a Calendar or Clock, or both, using the Inspector:

    NSDatePicker Inspector

    This is what it looks like:

    NSDatePicker Graphical mode

    gargantaun : I can't believe I missed that. Thanks
    Matthew Schinckel : It's easy to miss, there is just so much stuff in Cocoa.
    Matthew Schinckel : Note that the range selection stuff is a bit incomplete, you can use them, but you cannot bind to thew properly.
    jbrennan : @Matthew Schinckel: your m is upside down there....

0 comments:

Post a Comment