UIDatePicker - HELP PLEASE!!!

Discussion in 'iOS Programming' started by zcarter, Sep 12, 2008.

  1. zcarter macrumors member

    Apr 21, 2007

    I'm trying to get a timer going. How can I tie in my UIDatePicker (on timer mode) to work with my NSTimer.

    To start out with, whenever I connect a UIDatePicker in IB, it works fine, but the second I switch the mode to "Timer" my program crashes.

    So I need help getting the instance to populate a UIDatePicker in TIMER mode and the connecting it to an NSTimer..

    Can anyone help?

    Thanks so much...

  2. tyr2 macrumors 6502a


    May 6, 2006
    Leeds, UK
    As I understand it you need to configure it so that UIControlEventValueChanged is handled by your code when the user changes the time.

    This code should create or update an NSTimer that calls '- (void)setDate: (NSDate *)date animated: (BOOL)animated' on the date picker, the DatePicker doesn't link directly to an NSTimer object.

    Is this what you're doing? Any errors when the app crashes or compile warnings?
  3. zcarter thread starter macrumors member

    Apr 21, 2007
    That's what I'm trying to do yes...but it won't even populate an instance of the UIDatePicker...am I pissing additional code? It works fine if the "mode" of the UIDatePicker is anything except a "Timer"...but if I select the mode to be a timer..it crashes...so I guess I should start with the app not crashing when I load up, THEN worry about setting the timers...

    - Zac

Share This Page