I have a text field in my UI that when it\'s selected presents a UIDatePicker instead of the default keyboard, how could I set up a button as to dismiss the picker when the
You can solve this by adding this
[self.view endEditing:YES];
Add this where you want to dismiss date picker like i have added this on tap gesture
On viewDidLoad added a Tapgesture
UITapGestureRecognizer *gesRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)]; // Declare the Gesture.
gesRecognizer.delegate = self;
[self.view addGestureRecognizer:gesRecognizer];
After adding this on viewdidLoad Add this method to detect gesture recognizer
- (void)handleTap:(UITapGestureRecognizer *)gestureRecognizer{
NSLog(@"Tapped");
[self.view endEditing:YES];
}