1
我嘗試在Monotouch中設置UIDatePicker的初始日期。 DatePicker總是在UIDatePickerMode.Time中顯示1:05。如果我什麼都不做,它會正確顯示當前時間。Monotouch UIDatePicker SetDate always 1Hours and 5 Minutes
任何人都可以幫助我如何在Monotouch中做到這一點?
我嘗試在Monotouch中設置UIDatePicker的初始日期。 DatePicker總是在UIDatePickerMode.Time中顯示1:05。如果我什麼都不做,它會正確顯示當前時間。Monotouch UIDatePicker SetDate always 1Hours and 5 Minutes
任何人都可以幫助我如何在Monotouch中做到這一點?
您是否正確設置了NSDate校驗? This answer顯示了兩種創建NSDate的方法。
pick = new UIDatePicker (new RectangleF (0, 20, this.View.Bounds.Width, 10));
// Set NSDate:
DateTime date = DateTime.Parse("1981-07-01 22:21:00");
NSDate nsDate = DateTime.SpecifyKind(date, DateTimeKind.Utc);
// Get DateTime from NSDate:
date = DateTime.SpecifyKind(nsDate, DateTimeKind.Unspecified);
pick.Date = date;
pick.Mode = UIDatePickerMode.Time;
謝謝你的回答,但我不能得到它的工作....所以我在Methode中覆蓋它,並添加一小時五分鐘。 –
我不明白。你試圖設定這個時間到底是什麼?你想將它設置爲1:05嗎?你可以用你正在嘗試的代碼示例更新你的問題嗎? – holmes