Can I make a date picker limited to 3 days only? - ipad

In my iPad application, it is required that the date picker shows only 3 days/dates, i.e. today, tomorrow and day after tomorrow. Is it possible? If it is then how can I do it?
Any help would be highly appreciated.
Best Regards
PC

maximumDate
The maximum date that a date picker can show.
#property(nonatomic, retain) NSDate *maximumDate
minimumDate
The minimum date that a date picker can show.
#property(nonatomic, retain) NSDate *minimumDate

Related

islamicUmmAlQura UIDatePicker is not working properly

I am using islamicUmmAlQura UIDatePicker while developing iOS application as shown in the following
picture
and I have TWO problems summarised as follows:
1- The date that appears in the text field is gregorian while my UIDatePicker is islamic (Hijri) see figure
2- Sometimes the days in the Textfields are above normal! see figure
I have an extension on github to convert dates. Have a look. mine is persian date so you just need to replace the below code with mine inside the extension:
datePicker.calendar = Calendar(identifier: .islamicUmmAlQura)
[https://github.com/Fridday/PersianDatePicker][1]

How to modify UIDatePicker to get rid of era being shown?

When I set UIDatePickder calendar type to Arabic calendar like below
NSCalendar *hijriQamariCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSIslamicCivilCalendar];
[self.resultCalendarOutlet setCalendar:hijriQamariCalendar];
I get era also displayed in the UIDatePikcer. I am looking for a way to either have the era removed from the UIDatePicker from being displayed or customize its value/text.
UIDatePicker with Arabic Calendar showing era:
Please see the given images. I am not sure if this is possible first. However, UIDatePicker for Gregorian calendar doesn't display any era information.
UIDatePicker with Gregorian Calendar - No era :
which is fine for me.

datePicker shows 1.January

I am using Xcode and programming for ios.
I have a datePicker in my application for reservations.
You can't reserve dates that passed.
When I press on datePicker, when it opens, instead of "Today" it shows "Thu 1 Jan".
If I scroll for one day up, it will show "Fri 2 Jan".
But, if I scroll for few day in past, when it comes back to today's date it shows "Today", as it should, and everything works normal from that point.
Even if it says "Thu 1 Jan" if I save date and time, it shows correct date and time.
- (void)showDatePicker {
_orderTableView.userInteractionEnabled = NO;
_datePicker.date = _order.scheduleDate;
_datePicker.minimumDate = [NSDate date];
[UIView animateWithDuration:0.3 animations:^{
_datePickerView.frameBottom = self.view.frameBottom;
}];
}
Every suggestion is more than appreciated.
Edit1: Not sure if relevant, but minimum Date I put as Constraints is 01/01/1970 (that year New Year was on Thursday).
I was having this exact same problem and finally realized that the date I was giving the picker was not the date I thought I was giving it (01/01/0001 instead of the current date). Giving it the right date fixed the problem. Note that I am using Xamarin and C# but the concept may be the same.
Select your UIDatePicker in attribute inspector in Date choose current date.This will display your current date.

datePicker with maximum year current year

I am developing an iPhone app where user can save Birthdays along with other data.
For Birthday I am trying to add a UIDatePicker that shows date, month and year. for the year I want to set the picker maximum range to current year and after that an empty slot (just like the contact/phone app - add birthday option).
Is there anyway I can do that using UIDatePicker or do I have to use custom picker.
You can set the property maximumDate with current Date object. It will not allow the user to select any date beyond today. However it will not show the empty slots but grayed out slots. If user will try to select it, picker will again set with max possible date.
datePicker. maximumDate = [NSDate date];

iOS uidatepicker set time for each day

I want my iPhone app to have a date&time picker with constraints on time 10 AM to 5 PM for all future days. For example,my user should be able to select today with maximum of 5 PM or a future date with time between 10 am and 5 pm.
The minimum and maximum date properties doesnt help me with my requirement. Any possible solution? Thanks in advance :)
UIDatePicker doesn't appear to support a minimum or maximum time, only date.
You will have to either subclass UIDatePicker and create your own, or possibly alert the user when they select something out of your bounds.
A similar question was posted here: Time range on date picker for specific dates iPhone

Resources