DatePicker in Timer Mode - How to get the value

All*_*len 6 iphone uidatepicker

I'm trying to get a datepicker in countdowntimer mode to simply allow me to select minutes and seconds and then get that value when you click a button. I set up the picker in IB and use this code, but the result is always Null when I select any combination of minutes and hours and click the button...Obviously I'm missing something. Any help on getting this to work would be appreciated.

@interface ThisPicker : UIViewController {

IBOutlet UIDatePicker *datePicker;

}

-(IBAction)buttonPressed:(id)sender;

@end

@implementation ThisPicker

-(IBAction)buttonPressed:(id)sender{

    datePicker = [[UIDatePicker alloc] init];
    datePicker.datePickerMode = UIDatePickerModeCountDownTimer;

    NSLog(@"%@",[datePicker countDownDuration]);

  }

  @end
Run Code Online (Sandbox Code Playgroud)

iPr*_*abu 8

如果你想要一个小时分钟格式

-(IBAction)buttonPressed:(id)sender
  {


    NSDateFormatter *dateformatter = [[NSDateFormatter alloc] init];
    [dateformatter setDateFormat:@"HH:mm:ss"];
    NSLog(@"%@",[dateformatter stringFromDate:[datePicker date]]);

  }
Run Code Online (Sandbox Code Playgroud)