Skip to content
A drop in UITextView subclass that handles dismissing the keyboard with your finger, just like in the Messages.app.
Objective-C
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
MADismissiveTextView
Sample.xcodeproj Added project to github. Feb 18, 2012
Sample
.gitignore
LICENSE.txt
README.textile

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.