title: UITextField Custom Input View won't dismiss
body: <p>I am having some issues with a custom input view for my UITextField, i have used a UIDatePickerView with an Accessory view which is a UIButton. I have hooked the unbutton up to a method which captures the value, loads it into the field and then attempts to dismiss custom input view without any success...  </p>
  
  <p>My Field declaration and initialisation looks as follows</p>
  
  <pre><code>    int width = self.controller.view.frame.size.width;
  UITextField* field = [[UITextField alloc] initWithFrame:CGRectMake((width / 100) * 40, 5, (width / 100) * 60, 40)];
  self.fieldControl = field;
  field.placeholder = @"Select Date..";
  field.textColor = self.controller.fieldColor;
  self.datePicker = [UIDatePicker new];
  field.delegate = self;
  self.datePicker.datePickerMode = UIDatePickerModeDate;
  UIButton* close = [UIButton buttonWithType:UIButtonTypeSystem];
  [close setFrame:CGRectMake(width - 60, 20, 50, 50)];
  close.backgroundColor = self.backgroundColor;
  [close setTitle:@"Done" forState:UIControlStateNormal];
  [close addTarget:self action:@selector(datePicked) forControlEvents:UIControlEventTouchUpInside];
  field.inputAccessoryView = close;
  field.inputView = self.datePicker;
  [self addSubview:field];
  </code></pre>
  
  <p>My Date picked method looks like this</p>
  
  <pre><code>    -(void)datePicked
  {
      NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
      [formatter setDateFormat:@"dd/MM/yyyy"];
  
      NSString *stringFromDate = [formatter stringFromDate:self.datePicker.date];
  
  
      UITextView* field = self.fieldControl;
      field.text = stringFromDate;
  
      [field endEditing:YES];
      [field resignFirstResponder];
  }
  </code></pre>
  
  <p>I can't figure out why this is not working, i have tried the endEditing method on various views and nothing seems to work. I notice that the text field does lose voce in that it no longer shows the flashing curser... tapping on another uitextfield shows the regular keyboard which when dismissed closes my custom input view... what am i missing? </p>