DateTimeRow() の開始時刻を設定して、日付をクリックするたびに DateTime ピッカーの時刻が午前 7 時 30 分になるように設定しようとしています。
次のコードは、日付ピッカーを回転させずに、表示テキストのみを変更しています。
row = DateTimeRow() {
$0.minuteInterval = 30
}.onCellSelection({(cell,row) in
if row.baseCell.detailTextLabel?.text == nil {
// Setup the start date
var currentDate = NSDate() as Date
currentDate = currentDate.setHoursMinutes(hour: 7, minute: 30)
let dateFormatter = DateFormatter()
dateFormatter.timeStyle = .short
dateFormatter.dateStyle = .short
dateFormatter.locale = NSLocale.current
// This will show the current day date with time of 7:30 AM
row.baseCell.detailTextLabel?.text = dateFormatter.string(from: currentDate)
}
ピッカーに直接アクセスして setDate を呼び出す方法はありますか:
timePicker.setDate([My Date here], animated: true)
ありがとうございます