I have used uipickerview from interface in my application.But it is not selecting the current date and time.Please,help me.
Thanks
provide some code i think this will help...
do you have selected the property MaxDate as today ? if not then select as.
Related
I want to show the particular day of week when the user select a particular date from datepicker.
When the user clicks on day button i want to automatically select the day of week for that selected date??
[self.datePicker setDate:[NSDate date] animated:NO];
try this, let me know if it doesnt work. i havent tried it.
hope it works, happy coding :)
I want to have a time range on a UIDatePicker, so I can display what times users can book a meeting. Say on May 25th, they can book between 12pm and 8 pm, if they scroll to May 26th they can book between 4pm and 8pm.
So I'm wondering how I can display this in a UIDatePicker? Users can't choose time outside of a preset I have for each day.
Any help is appreciated!
I found this one, hope this will help you out..
Can UIDatePicker's minimumDate and maximumDate include time?
Enjoy Coding :)
Sorry, but no. UIDatePicker can only set ranges for dates. If you want to restrict the range of the hours, you will have to subclass uidatepicker and create your own custom class.
Here's a link: UIDatePicker hours interval (NSCalendarUnit?)
Hope this helped!
I would suggest using UIPickerView to make your own date picker. Every time a date is selected, you can change what times are available inside pickerView:didSelectRow:inComponent:.
What I ended up doing was to add a target to the date picker, and check if the time of the date chosen matched the hours I preset and display an alert view if they didn't match.
I have a medical app that allows the user to calculate a patient's age based on date of birth entered with a date picker. For convenience, I set the default date for the date picker object in Interface Builder to 1/1/1950. However, I noticed that in iOS 5 the default date no longer sets when the date picker initially loads. The default date automatically becomes the upper date limit (if that parameter enabled in Interface Builder), or the current date if this upper limit is not enabled. The default date field in Interface Builder still has "1/1/1950" set. The same version of the app on an older device compiled with iOS 4 still works properly, with the date picker scrolling to 1/1/1950 on loading. I very much would appreciate any advice for fixing the problem. Thanks in advance.
In your ViewController's viewDidLoad, log the value of the picker. If it is not set correctly, then you can try setting the value programmatically in viewDidLoad.
I want to show only day and month and not year in my date picker. Not sure how to achieve this. Please suggest.
you'll find the answer by Googling this and clicking on the first entry which happens to be from Stackoverflow also: UIDatePicker show only month and day
Hope it helps!
I solved this by setting the maximumDate property to current date. This disabled the dates from current date.
I'm trying to make a UIDatePicker which allows the selection of hours only between 6.00 and 17.00. The other hours shall be inactive but still visible.
I think it can be done with setting up the picker calendar and then use this:
- (NSRange)maximumRangeOfUnit:(NSCalendarUnit)unit
but I'm not sure how.
Maybe someone can help me.
Thank you!
Sorry, but UIDatePicker doesn't support setting valid time ranges like you describe. The only options are minimum and maximum dates.
You'll either need to build a custom control from scratch or try to subclass UIDatePicker, but that's not a path I'd recommend.