I am looking for a little help and I have searched around however found nothing on this so far. Maybe somebody can help.
So I wondered if there is a way to set a ‘datasource’ for the UIDatePicker. I want to create a date picker that only shows certain dates and times that are available, say for instance;
a view with
Thur 9 Aug: 0900, 0930, 1000, 1100, 1130, 1200
Fri 10 Aug: 0900, 0930, 1000, 1030, 1100, 1130, 1200
(No weekend)
Mon 13 Aug: 0900, 0930, 1000, 1030, 1100, 1130, 1200
Is this functionality supported by UIDatePicker or will I be looking at using UIPickerView instead?
Thanks,
A
* Update: a good example is within Apples Apple Store app, you can select a Genius Bar appointment from a restricted value UIDatePicker *
You’ll need to use a UIPickerView, since UIDatePicker does not not inherit from UIPickerView (which it says in the last sentence of the “Overview” in the Apple documentation which I linked for you).
UIPickerView is what uses a data source.
UIDatePicker has a built-in data source which developers can’t touch.
I’m guessing Apple’s App Store Genius Bar appointment functionality has to be done with a UIPickerView. While UIDatePicker does have “
maximumDate“, “minimumDate” & “minuteInterval” properties, there’s no way to set a selection or range of available dates & times within a date picker.