TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Nov 2015 |
Maintained by Bryn Bodayle.
A simple view which allows for an iOS Messages style keyboard input view and panning behavior.
Supports iOS 7.0+
This is a UIView subclass which allows for observing the frame of a UITextView or UITextField's inputAcessoryView. This allows your to keep the text field above the keyboard as it moves. Also this allows for interactive keyboard dismissal using UIScrollView's keyboardDismissMode property.
To run the example project, clone the repo, and run pod install
from the Example directory first.
Here is a sample viewDidLoad implementation.
- (void)viewDidLoad {
[super viewDidLoad];
self.tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeInteractive;
BABFrameObservingInputAccessoryView *inputView = [[BABFrameObservingInputAccessoryView alloc] init];
inputView.userInteractionEnabled = NO;
self.textField.inputAccessoryView = inputView;
__weak typeof(self)weakSelf = self;
inputView.keyboardFrameChangedBlock = ^(BOOL keyboardVisible, CGRect keyboardFrame){
CGFloat value = CGRectGetHeight(weakSelf.view.frame) - CGRectGetMinY(keyboardFrame);
weakSelf.toolbarContainerVerticalSpacingConstraint.constant = MAX(0, value);
[weakSelf.view layoutIfNeeded];
};
}
BABFrameObservingInputAccessoryView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'BABFrameObservingInputAccessoryView'
Bryn Bodayle, [email protected]
BABFrameObservingInputAccessoryView is available under the MIT license. See the LICENSE file for more info.