uidatepicker
UIDatePicker upon date changed
When properly configured, a UIDatePicker object sends an action message when a user finishes rotating one of the wheels to change the date or time; the associated control event is UIControlEventValueChanged. so you need to add your class to handle UIControlEventValueChanged event in your picker: [picker addTarget:self action:@selector(dateChanged:) forControlEvents:UIControlEventValueChanged]; … – (void) dateChanged:(id)sender{ // handle … Read more
Disable Past Date in UIDatePicker in IPhone Objective C
Did you try this [picker setMinimumDate: [NSDate date]];
UIDatePicker, setting maximum and minimum dates based on todays date
Not tested, but you probably want something like this. NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDate *currentDate = [NSDate date]; NSDateComponents *comps = [[NSDateComponents alloc] init]; [comps setYear:30]; NSDate *maxDate = [calendar dateByAddingComponents:comps toDate:currentDate options:0]; [comps setYear:-30]; NSDate *minDate = [calendar dateByAddingComponents:comps toDate:currentDate options:0]; [datePicker setMaximumDate:maxDate]; [datePicker setMinimumDate:minDate]; Update for Swift 4.1 let calendar = … Read more
Observing change in UIDatePicker
You need to add to your UIDatePicker the UIControlEventValueChanged event to handle date changes: [myDatePicker addTarget:self action:@selector(dateIsChanged:) forControlEvents:UIControlEventValueChanged]; Then the implementation: – (void)dateIsChanged:(id)sender{ NSLog(@”Date changed”); }
Anyone find that UIDatePicker is broken under iOS 14?
To add some additional information to Oscar’s answer… UIDatePicker now has three different styles, as per documentation here and here. The date picker’s style is accessible by the .preferredDatePickerStyle property which can be set to four different cases: .automatic – A style indicating that the system picks the concrete style based on the current platform … Read more
UIControlEventEditingChanged doesn’t get fired when using setText of UITextfield
I had to rate this question up because this is super important. It appears this has changed in iOS6. Maybe even iOS5. This event USED to be the preferred method for observing text changes in a UITextField. I’ve been using it since iOS3. After recompiling my app on iOS6 to perform some updates, it mysteriously … Read more
Open UIDatePicker programmatically in iOS 14
You can use a datePicker with .compact style and put a UILabel on top of it and give it a background color to hide the datePicker behind it, and make sure the label user interaction is disabled then you should be able to tap on the datePicker and it will show the modal and then … Read more
jQuery Date Picker – disable past dates
You must create a new date object and set it as minDate when you initialize the datepickers <label for=”from”>From</label> <input type=”text” id=”from” name=”from”/> <label for=”to”>to</label> <input type=”text” id=”to” name=”to”/> var dateToday = new Date(); var dates = $(“#from, #to”).datepicker({ defaultDate: “+1w”, changeMonth: true, numberOfMonths: 3, minDate: dateToday, onSelect: function(selectedDate) { var option = this.id == … Read more
Jquery date picker z-index issue
Put the following style at the ‘input’ text element: position: relative; z-index: 100000;. The datepicker div takes the z-index from the input, but this works only if the position is relative. Using this way you don’t have to modify any javascript from jQuery UI.