ANKeyboardObserverManager 1.0.0

ANKeyboardObserverManager 1.0.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Sep 2015

Maintained by Candyan.



  • By
  • Candyan

ANKeyboardObserverManager make your keyboard observe easier and more flexible. I

Installation

To install ANKeyboardObserverManager either:

pod 'ANKeyboardObserverManager'
  • or copy Source/ANKeyboardObserverManager.h and Source/ANKeyboardObserverManager.m in your project.

Usage

Use [ANKeyboardObserverManager sharedManager] directly or alloc/init ANKeyboardObserverManager instance in the class you want to use it.

Then add the observer:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [[ANKeyboardObserverManager sharedManager] addKeyboardObserver:self
        withkeyboardWillShowBlock:^(CGRect keyboardEndFrame, NSTimeInterval animateDuration, NSDictionary *info) {
            your code 
        }
        keyboardWillHideBlock:^(CGRect keyboardEndFrame, NSTimeInterval animateDuration, NSDictionary *info) {
            your code
     }];
}

When you do not want to observe the keyboard, remove the observer:

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [[ANKeyboardObserverManager sharedManager] removeKeyboardObserver:self];
}

Effect

Alt text