My app has a navigation controller. All my controllers pop and push. One controller has 12 textfields. 2 textfields invoke other controllers. This is a UIDatePicker and then with delegation methods we set the current date in this two fields.
- (IBAction) beginEditingDateStart:(id) sender{
[sender resignFirstResponder];
[self.remedyName becomeFirstResponder];
[self.remedyName resignFirstResponder];
[self.doseName resignFirstResponder];
[self.count resignFirstResponder];
[self.dateFrom resignFirstResponder];
[self.dateTill resignFirstResponder];
[self.doseAmount resignFirstResponder];
[self.view endEditing:NO];
[self.view resignFirstResponder];
DatePickerViewController *dateView = [[DatePickerViewController alloc] initWithNibNameAndKey:@"DatePickerViewController" bundle:[NSBundle mainBundle] key:@"from"];
dateView.delegate = self;
[self.navigationController pushViewController:dateView animated:YES];
[dateView release];
The problem is when I start to edit these two fields and the keyboard is active, we go to the datepicker controller with the keyboard and it hides my datepicker. I know that this problem can be solved but I don't know how. Please help me.
This will ask each view to resign first responder.
[self.view endEditing:YES];
As this will ask each view to resign first responder all the other calls to resign first responder are redundant. They should be removed and to reduce the risk of calling something incorrectly or out or turn like
[self.remedyName becomeFirstResponder];
You can read more about it in the Apple Docs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With