Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using ActionSheetDatePicker as CountDownTimer-Picker #72

Closed
mgmart opened this issue Oct 10, 2014 · 4 comments
Closed

Using ActionSheetDatePicker as CountDownTimer-Picker #72

mgmart opened this issue Oct 10, 2014 · 4 comments

Comments

@mgmart
Copy link

mgmart commented Oct 10, 2014

I tried to use the ActionSheetDatePicker in CountDownTimer mode.

// let selectedDate = NSDate(timeIntervalSince1970: NSTimeInterval(600))
let selectedDate = NSDate(timeIntervalSinceReferenceDate:  NSTimeInterval(600))
var datePicker = ActionSheetDatePicker(title: "Time Interval", datePickerMode: UIDatePickerMode.CountDownTimer, selectedDate: selectedDate, target: self, action: "datePicked:", origin: self.view)

datePicker.minuteInterval = 10
datePicker.showActionSheetPicker()

I would expect the DatePicker to be preset at 0h and 10min but it is preset at 1h 10min

More important I assume the function datePicked is called by ActionSheetDatePicker with a NSNumber instead of a NSDate. The number / date is most of the time 60, regardless of the selection I make in the picker.

@skywinder
Copy link
Owner

CountDownTimer is quite new feature for ActionSheetPicker, that implemented in #50.
I think it's need to do some improvements of this feature as you described in this issue.

@mgmart
Copy link
Author

mgmart commented Oct 10, 2014

Good to know. I'll wait for that :-)

Thanks for your effort!

@mgmart
Copy link
Author

mgmart commented Oct 11, 2014

Couldn't wait :-)

The issue with the additional hour is addressed in #74.

The value which with the action block is called is a double wrapped in NSNumber.
This is unfortunately not so easy to see in Swift.

@mgmart mgmart closed this as completed Oct 11, 2014
@jklp
Copy link

jklp commented Oct 14, 2014

Hi @mgmart, I'm the one who fixed up #50 (as mentioned by @skywinder) and have looked through your changes and think you're right - in that you need to set "duration" instead of the "minuteInterval" on the ActionSheetDatePicker.

The diff also looks good and same with the new constructor for setting the initial duration.

Re: The action callback returning an NSTimeInterval (which is a double) instead of an NSDate, I think this is correct behaviour though, as I'm not sure how else you'd represent the number of minutes the user has selected using an NSDate?

@skywinder - up to you how you want to proceed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants