In my iPhone app, I am facing some problems related to keyboard show/hide behavior.
I have three text fields; when the third text field is clicked, I want to display a UIPickerView
and hide the keyboard for that text field. That I can do.
Now the problem is that, if the keyboard of either first or second text field is visible, and I click on the third text field, the picker becomes visible, but it appears behind the keyboard (it is only behind the keyboard of the first or second text field).
So what should I do to make the picker visible by itself and not to display any keyboard at that time?
Here is the code:-
-(void) textFieldDidBeginEditing:(UITextField *)textField{
if (textField==thirdTextField) {
[scroll setFrame:CGRectMake(00, 48, 320, 160)];
[scroll setContentSize:CGSizeMake(320,335)];
[picker setHidden:NO];
[tool1 setFrame:CGRectMake(0,180,320,44)];
[tool1 setHidden:NO];
[self.picker reloadAllComponents];
[firtTextField resignFirstResponder];
[secondTextField resignFirstResponder];
[thirdTextField resignFirstResponder];
}
else {
[scroll setFrame:CGRectMake(00, 48, 320, 200)];
[scroll setContentSize:CGSizeMake(320,335)];
[tool1 setHidden:NO];
[tool1 setFrame:CGRectMake(0,220,320,44)];
}
}
the problem is like