title: Disable keyboard on UITextField on edit
body: <p>Since when I click the UITextField the date picker is showing along with the keyboard, I want to hide the key board operation  on dob-text field?Here my code</p>
  
  <pre><code>- (void)removeViews:(id)object 
      {
      [[self.view viewWithTag:9] removeFromSuperview];
      [[self.view viewWithTag:10] removeFromSuperview];
      [[self.view viewWithTag:11] removeFromSuperview];
      }
  
      - (void)dismissDatePicker:(id)sender 
      {
      CGRect toolbarTargetFrame = CGRectMake(0, self.view.bounds.size.height, 320, 44);
      CGRect datePickerTargetFrame = CGRectMake(0, self.view.bounds.size.height+44, 320, 216);
      [UIView beginAnimations:@"MoveOut" context:nil];
      [self.view viewWithTag:9].alpha = 0;
      [self.view viewWithTag:10].frame = datePickerTargetFrame;
      [self.view viewWithTag:11].frame = toolbarTargetFrame;
      [UIView setAnimationDelegate:self];
      [UIView setAnimationDidStopSelector:@selector(removeViews:)];
      [UIView commitAnimations];
      }
  
      - (IBAction)but 
      {
      //[eventText resignFirstResponder];
      [dob resignFirstResponder];
  
  
      if ([self.view viewWithTag:9]) 
      {
          return;
      }
      CGRect toolbarTargetFrame = CGRectMake(0, self.view.bounds.size.height-216-44, 320, 44);
      CGRect datePickerTargetFrame = CGRectMake(0, self.view.bounds.size.height-216, 320, 216);
  
      UIView *darkView = [[UIView alloc] initWithFrame:self.view.bounds ];
      darkView.alpha = 0;
      darkView.backgroundColor = [UIColor blackColor];
      darkView.tag = 9;
      UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissDatePicker:)] ;
      [darkView addGestureRecognizer:tapGesture];
      [self.view addSubview:darkView];
  
      datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height+44, 320, 216)] ;
      datePicker.datePickerMode=UIDatePickerModeDate;
      datePicker.tag = 10;
      [datePicker addTarget:self action:@selector(changeDate:) forControlEvents:UIControlEventValueChanged];
  
      [self.view addSubview:datePicker];
  
      UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height, 320, 44)] ;
      toolBar.tag = 11;
      toolBar.barStyle = UIBarStyleBlackTranslucent;
      UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil] ;
      UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissDatePicker:)] ;
      [toolBar setItems:[NSArray arrayWithObjects:spacer, doneButton, nil]];
      [self.view addSubview:toolBar];
  
      [UIView beginAnimations:@"MoveIn" context:nil];
      toolBar.frame = toolbarTargetFrame;
      datePicker.frame = datePickerTargetFrame;
      darkView.alpha = 0.5;
      [UIView commitAnimations];
      //[datePicker addTarget:self action:@selector(dateText:)forControlEvents:UIControlEventValueChanged];
      //NSDateFormatter *_dateFormatter = [[NSDateFormatter alloc] init];
      //_dateFormatter.dateStyle = NSDateFormatterFullStyle;
      //dateText.text = [NSString stringWithFormat:@"%@",
      // [_dateFormatter stringFromDate:datePicker.date]];
  
      //[self.tableview reloadData];
  
      }
  
  I added the resignfirstresponder also,since its showing the same error
  
      - (BOOL)textFieldShouldReturn:(UITextField *)textField
      {
      return [textField resignFirstResponder];
      return [txt1 resignFirstResponder];//dob textfield
      }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/oDnau.png" alt="enter image description here"></p>