开发者

How to get value of "countDownDuration" of UIDatePickerModeCountDownTimer?

开发者 https://www.devze.com 2023-03-02 21:26 出处:网络
I know this question has been posted on this forum before: How do you get the time interval for UIDatePicker in UIDatePickerModeCountDownTimer mode?

I know this question has been posted on this forum before: How do you get the time interval for UIDatePicker in UIDatePickerModeCountDownTimer mode?

However, the answer mentioned there isnt working for me and i am not able to comment on the earlier post hence this new question.

I have a simple application where i have a UIDatePicker in CountDownTimer mode. I want to retrieve whatever value the user sets it to and store it or print it开发者_开发问答 to log.

    - (IBAction) datePickerValueDidChange:(id)sender {
      NSLog(@"datePicker.countDownDuration: %f", timerPicker.countDownDuration);
    }

the value being printed is 0 always. Dnt know where i am going wrong so any help will be appreciated.


You haven't posted much code, but my guess would be that your picker has a different name than timerPicker.

Alternately you've got a local instance variable conflict with your picker property and that referring to it as self.timerPicker.countDownDuration will do the trick.

A third option is that you've either not connected and/or declared your viewController as being the picker's delegate, or if you have then you haven't included the delegate declaration in your interface (though the latter is less likely because you should get a noticeable build-time error).

Otherwise you'll need to post some more code, including where you declare it and where you set its values.


Check this out, there is full tutorial about count down timer with date picker --- http://aarlangdi.blogspot.com.au hope this is helpful to you guys

0

精彩评论

暂无评论...
验证码 换一张
取 消