Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A drop in UITextView subclass that handles dismissing the keyboard with your finger, just like in the Messages.app.

branch: master
README.textile

MADismissiveTextView

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

Usage

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.

Example

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;
Something went wrong with that request. Please try again.