1
DateTimeRow()の開始時刻を設定しようとしています。その日付をクリックするたびに、DateTimeピッカー時間は午前7時30分に回転します。Eureka DateTimeRowを特定の時間に設定します。
timePicker.setDate([My Date here], animated: true)
:
次のコードは、唯一の日付ピッカー回転していない間、表示テキストを変更している:のような
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
ありがとう
はい、この関数を呼び出すと、ピッカーが表示されたときに、それがスクロールしますしたいですダあなたが設定した、アニメーションかどうかで。 –
ありがとうございます。添付の画像でわかるように、表示テキストが変更されている間は日付ピッカーはスクロールされません –
datepickerビューを表示する前にこの関数を呼び出しましたか? –