I have implemented a view, in which there is two text fields. At first text field, when user click on it, there is a display of picker view. When user clicks on other text field keyboard is shown. But when user go from second text field to first text field it still shows the keyboard and there is a picker view on the back of this keyboard. I am unable to resign this keyboard when user move from second to first textfield without pressing keyboard done button.
-(void)textFieldDidBeginEditing:(UITextField *)myTextField
{
if(myTextField == firsttextfield)
{
[firsttextfield resignFirstResponder];
medicationtypepicker = [[UIPickerView alloc] initWithFrame:CGRectMake(0,190,320,215)];
medicinetypearray = [[NSMutableArray alloc]initWithObjects:@"Capsules",@"Eyedrops",
@"Eardrops",@"Nosedrops",@"Inhaler",@"Syrup",@"Injections",@"Oils",@"Ointment", nil];
medicationtypepicker.delegate = self;
medicationtypepicker.showsSelectionIndicator = YES;
medicationtypepicker.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[self.view addSubview:medicationtypepicker];
}
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
[secondtextfield resignFirstResponder];
return YES;
}
if some one has idea to dismiss the keyboard. Please provide the solution.
Thankyou very much.