user1724168
user1724168

Reputation:

Custom DatePicker-iOS

I am getting my JSON data from the server, server get data from the sensor placed in different places collecting info between 6 am-10 pm. I implemented datepicker to be chosen any spefici time wanted to be seen by user. However I would like to exclude 10pm-6am? I want to design my datepicker in a way user could not able choose any time between 10pm-6am. Is there any way to achieve this goal? enter image description here

Upvotes: 1

Views: 2665

Answers (1)

Charan
Charan

Reputation: 4946

You'll need to use a UIPickerView, by making 4 segments as date picker and populate them through arrays

since UIDatePicker does 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.

So, just dump the customised data to the 4 segmented normal picker view.

Upvotes: 3

Related Questions