Reputation: 51
I want to hide the keyboard without pressing the Return button in system keyboard, so that it automatically hides when I select the next text Field.
Here, I have four TextField
s, placed inside one Custom Cells. They all have tag
s associated with them. Then I put the custom Cell into UITableViewController
.
First text field displays a Date Picker
, using an action sheet. When I enter into the second text field, it shows the keyboard. My problem is that when I move to the next text field, the previous text field does not move away.
Upvotes: 1
Views: 231
Reputation: 339
-(BOOL)textFieldShouldReturn:(UITextField *)textField
Try this method......if u go for next text field keyboard will popup again.
Upvotes: 0
Reputation: 248
Try this code ..in this touchesbegan it will be resign the keyboard when you wil touch on the screen ..and when you will select next filed it will call keyboard agin!
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
CGPoint pt = [[touches anyObject] locationInView:self.view];
[usertextfiledobject resignFirstResponder];}
Upvotes: 1
Reputation: 330
Use this ..code no need to return keyboad of first textfiled..
(BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
if(textField.tag==1) { [self showAction sheet]; return NO;
} return YES; }
Upvotes: 0
Reputation: 1095
Try its textFieldDidEndEditing method to check the Enter button pressed.As soon it is pressed,it will call this method having code to resign keyboard.
[textField resignKeyboard];
Upvotes: 0