0

Just now started to learn IOS.

In my sample app,

While I'm typing keyboard shows in ios simulator. But After finish typing I want to click a button "Click me".

But I cannot type button, Since the button is hidden in the keyboard. I don't Know how to hide the keyboard. I clicked on the return button in the keyboard, but it doesn't hide.

How Can I click the button "Click me" ? What is the default functionality in IOS ?

Jeeva J
  • 3,173
  • 10
  • 38
  • 85

2 Answers2

1

Use this

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
  [textField resignFirstResponder];
  return YES;
}
Dima
  • 23,484
  • 6
  • 56
  • 83
Chandru
  • 247
  • 2
  • 18
1
@interface MyController: UIViewController <UITextFieldDelegate> {
   UITextField *yourTextField;


}

.m file

yourTextField.delegate=self;

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
  [yourTextField resignFirstResponder];
  return YES;
}
codercat
  • 22,873
  • 9
  • 61
  • 85