Dismissing the keyboard in a UIScrollView

Posted by Nicholas1024 on Stack Overflow See other posts from Stack Overflow or by Nicholas1024
Published on 2011-02-28T15:23:08Z Indexed on 2011/02/28 15:25 UTC
Read the original article Hit count: 211

Alright, I have a couple of UITextFields and UITextViews inside a UIScrollView, and I'd like to set the keyboard to disappear whenever the scrollview is touched or scrolled (except when you touch down inside the text field/view, of course).

My current attempt at doing this is replacing the UIScrollView with a subclass, and setting it to call a removeKeyboard function (defined inside the main view controller) inside the touchesBegan method. However, this only removes the keyboard for a normal touch, not when the view is simply scrolled. So, what's the best way to remove the keyboard inside a UIScrollView?

Thanks in advance for your help.

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about keyboard