Reputation: 5096
I am now using default UIDatePicker
which show only date in my UIDatePicker
view.The point is, I want to limit my datepicker for showing with range and disable every sunday from that picker cause I am creating auction app.Auction close on sunday,so I need to hide every sunday in my UIDatePicker
.Also I want to show from unlimited date from past to current date only.
Simple,
1.Setting date range from (unlimited date which was past to current date only) [....dd/MM/yyyy to...current date only]
2.When I show a datepicker,I dont want to display sunday in that UIDatePicker
.
Here is what I have in java code
Map<String, String> auctionDate = new LinkedHashMap<String, String>();
SimpleDateFormat sdfDDMMYYYYEEE = new SimpleDateFormat("dd/MM/yyyy (EEE)");
SimpleDateFormat sdfDDMMYYYY = new SimpleDateFormat("dd/MM/yyyy");
SimpleDateFormat sdfEEE = new SimpleDateFormat("EEE");
for (int i = 0; i < 5; i++) {
if (sdfEEE.format(now).equals("Sun")) {
now.setTime(now.getTime() + 86400000);
i--;
continue;
}
auctionDate.put(sdfDDMMYYYY.format(now), sdfDDMMYYYYEEE.format(now));
now.setTime(now.getTime() + 86400000);
}
Is there anyway I can set this in Swift?Thank you...
Upvotes: 0
Views: 870
Reputation: 70997
You will need to create your own UIPickerView
for doing this. There is no method with which you can remove Sundays from a UIDatePicker
. What you can do instead is when the user selects a date, check whether its a Sunday. If it is, select the next date by default.
Upvotes: 1