Introduction
In this article I will explain the process of hiding the keyboard when we click on the keyboard's Return button or click on the background screen of the UI.
Step 1
To hide the keyboard when we click on the Keyboard's Return button:
-(BOOL)textFieldShouldReturn:(UITextField *)textField {
[textField resignFirstResponder];
return YES;
}
Step 2
To hide the keyboard when we click on the background screen:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[textField resignFirstResponder];
}
Step 3
At last we run our application and see the output:
Output
Output 1 in iPhone:
Output 2 in iPhone:
Output 3 in iPhone: