A UIScrollView consists of various UITextFields like name, phone, etc. Of course, When i click on a textField, keyboard appears.
I want to know how to make the keyboard disappear once the user starts scrolling. Thanks for any Help!
A UIScrollView consists of various UITextFields like name, phone, etc. Of course, When i click on a textField, keyboard appears.
I want to know how to make the keyboard disappear once the user starts scrolling. Thanks for any Help!
You can implement UIScrollViewDelegate and once the user starts to scroll using scrollViewDidScroll method, you can make the keyboard go hidden. Try like this:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
[self.view endEditing:YES];
}
Make sure you set the delegate for your UIScrollView.
Try following code:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
[self.textField resignFirstResponder];
}
Use this to hide keyboard.
-(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
[self.view endEditing:YES];//hide keyboard
}