0

I use a UIText field as a toggle to display and then update with a value each time it is depressed, and use the the didbeginediting as the action to resign the keyboard. In 6.2 this works fine in 7 the keyboard is not resigned.

-(void)toggleAnswer {

self.myText resignfirstresponder;
if ([myText.text isEqualTo @"Yes"]) {
    myText.text = @"No";
   }
else {
    myText.text = @"No";
   }
}

5 Answers5

3

This may be because I'm using a custom keyboard, but calling

[myUITextField resignFirstResponder];

stopped removing my keyboard under iOS7, despite having worked fine under iOS6. However, what I found works great under both iOS6 and iOS7 is calling

[myUIViewController.view endEditing:YES];
mrzzmr
  • 695
  • 1
  • 7
  • 6
1

Take three Step in count

1) set delegate for textfield <UITextFieldDelegate>

2) set Delegate for particular textfielf yourtextfielg.delegate=self.

3) Resign that particular textField [txt resignFirstResponder].

codercat
  • 22,873
  • 9
  • 61
  • 85
Deep Gami
  • 508
  • 3
  • 13
0
try this


 if(textField == textFieldname1)
    {
        [textFieldname2 becomeFirstResponder];
    }
    else if(textField == textFieldname2)
    {
        [textFieldname3 becomeFirstResponder];
    }
    else
    {

            // Not found, so remove keyboard.
            [textField resignFirstResponder];

    }
Muralikrishna
  • 1,044
  • 10
  • 17
0

use.

[textField resignFirstResponder];
codercat
  • 22,873
  • 9
  • 61
  • 85
Pravin
  • 44
  • 9
0

try this:

 @interface ViewController ()<UITextFieldDelegate>

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    return YES;
}

// set this somewhere

 yourTextField.delegate = self;
nickAtStack
  • 163
  • 8