I add a UIDatePicker as input view to UITextField
UIDatePicker *oBirth;
NSDateFormatter *dateFormat;
_editingField = [[UITextField alloc] initWithFrame : CGRectMake(80, 12, 215, 25)];
dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat : @"dd/MM/yyyy"];
oBirth = [[UIDatePicker alloc] initWithFrame : CGRectMake(0, 0, 120, 45)];
oBirth.date = [dateFormat dateFromString : sField];
NSLog(@"%@", oBirth.subviews);
[oBirth addTarget : self
action : @selector(updateDate:)
forControlEvents : UIControlEventValueChanged];
[oBirth addTarget : self
action : @selector(dismissDate:)
forControlEvents : UIControlEventTouchUpOutside];
[oBirth setDatePickerMode : UIDatePickerModeDate];
_editingField.tag = 1;
_editingField.inputView = oBirth;
How can I dismiss the UIDatePicker without creating an invisible view ?
Try this
Edit
For
dismissDatenot being called.Remove this piece of code
And add this
Your callback