您好我正在尝试使用 ActionSheetPicker 让用户选择提醒时间,但我收到标题中描述的错误。这是我的代码:
SelectTime(sender: validCell) // called when tapping a date
// Time Picker
func SelectTime(sender: UIView){
//let timePicker = ActionSheetDatePicker.show(withTitle: "Enter time for reminder", datePickerMode: .time, selectedDate: userDate, target: self, action: , origin: sender.superview!.superview)
let timePicker = ActionSheetDatePicker.show(withTitle: "Enter time for reminder", datePickerMode: .time, selectedDate: userDate, target: self, action: Selector(("timePicked")), origin: sender.superview!.superview, cancelAction: Selector(("timeCanceled")))
timePicker?.minuteInterval = 5
timePicker?.locale = Calendar.current.locale
timePicker?.show()
}
func timePicked(time: Date){
dateSelected.text = formatter.string(for: time)
}
func timeCanceled(){
print("Canceled")
dismiss(animated: true, completion: nil)
}
取消代码永远不会被调用,当我在 timePicker 上按取消时,它会在其下方显示另一个时间选择器,而没有任何按钮。取消时的 Gif http://www.giphy.com/gifs/l1J3zMQWJ23GpHEaY
dateSelected 也永远不会被调用。我做错了选择器吗?