1

In my iPad app there are 3 textboxes where i am using popoverview controller on second text box. here their are 2 cases

In First Case:

As i finish editing the first textbox and click the next button on keyboard that time the keyboard is resigning perfectly and the popoverview controller is opened on second text box.Here i had written the code when the next button of the first textbox click at that time the second textbox should became FirstResponder.

In Second Case:

Here the actual problem, When i finish editing the first textbox and directly touches the second textbox without clicking the next button on keyboard, that time popoverview controller menu is opened on second textbox and the keyboard is unable to resign , the keyboard is strucking over their my code for resigning the keyboard is not working.

user2260521
  • 65
  • 2
  • 6
  • Check out my answer to this question and let me know if it works: http://stackoverflow.com/questions/3019709/modal-dialog-does-not-dismiss-keyboard/10507689#10507689 – Chris Trahey Apr 09 '13 at 07:13
  • To clarify, the larger thread there (the accepted answer, too) might be what you are looking for. If you have Navigation controllers, though, use the linked answer – Chris Trahey Apr 09 '13 at 07:15
  • hey, am having the same problem .. did you find any solution ? – raw3d Apr 25 '13 at 11:57

4 Answers4

0

Write your code which you used on NEXT button event of Keyboard in this bellow method...

- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
    if (textField == yourFirstTextBox) {
       // write your code here   
    }
    return YES;
}
Paras Joshi
  • 20,427
  • 11
  • 57
  • 70
0
-(void)textFieldDidBeginEditing:(UITextField *)textfield
{

    if ([textfield tag]==yourtextfieldtag)//set tag for your textfield
    {
       [yourfirsttextfield  resignFirstResponder];
       [yoursecondtextfield  resignFirstResponder];
       .
       .
       .

     //Write all textField with resignFirstResponder
     }

 }
Goutham
  • 299
  • 1
  • 24
0

Here is the way you can handle your SoftKeypad

Handling Soft Keypad in iPhone Tutorial

There are three simple ways to handle keypad here

  1. Keypad go back when Button clicked.
  2. Keypad go back when user click on Return or Done button on keypad.
  3. Keypad go back when user Touch on Background screen/view.

Just follow 3rd way in you case. What you need to do is just crate a method in which call

method for the desired text field.

and Updated Related UIView class to UIControl in Interface Builder. as I have written all the information step by step to make it more easy and clear.

Here is the responsible code snip

- (IBAction)keypadGoBack:(id)sender {    
    [userNameTextField resignFirstResponder];
    [passwordTextField resignFirstResponder];
}

Hope this will help you.

swiftBoy
  • 35,607
  • 26
  • 136
  • 135
  • I have done the 3rd step, this case working but after editing the first textbox ,when i am directly clicking the second textbox instead of touching background or next or done button on keyboard it is not working .. the keyboard is stucking in this case – user2260521 Apr 09 '13 at 11:10
  • did you added **resignFirstResponder** for second text filed in the **keypadGoBack** method? – swiftBoy Apr 09 '13 at 12:27
0
-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
    if(textField==yourTextField)
    {
        [self.view endEditing:YES];
        // Write Your Popoverview Code / Extra Code
        return NO;
    }
    return YES;
}
  1. Here this method will get called when you will hit textfield.
  2. And check the textfield with yourtextFieldName if its match..it will resign all keyboard.if there is more than one also..with the help of.

    [self.view endEditing:YES];

  3. And you can do Extra Code also For popoverview and return no means It will not give keyboard to that perticuler textField. Thanks.

Maheta Dhaval K
  • 764
  • 6
  • 19