Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

30 lines (21 sloc) 1.125 kb


MADismissiveTextView is a drop-in UITextView subclass that handles dismissing the keyboard with your finger, just like in the


MADismissiveTextView is designed to be used in tandem with a UIScrollView as well as its UIPanGestureRecognizer. As such, this class only works with iOS 5.0 and up.


UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 44, 320, 416)];
[self.view addSubview:scrollView];

MADismissiveTextView *textView = [[MADismissiveTextView alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
textView.dismissivePanGestureRecognizer = scrollView.panGestureRecognizer;
textView.keyboardDelegate = self;
[self.view addSubview:textView];

Dismissive Keyboard Delegate

The MADismissiveKeyboardDelegate protocol allows you to make changes to your UI at key moments during the animation of the UIKeyboard. These delegate methods are all optional.

- (void)keyboardDidShow;
- (void)keyboardDidScroll:(CGPoint)keyboardOrigin;
- (void)keyboardWillBeDismissed;
- (void)keyboardWillSnapBack;
Jump to Line
Something went wrong with that request. Please try again.