iOS utility class allows you to access keyboard view and track keyboard animation.

(It was used by YYText)

Compatibility

iPhone / iPad / iPod with iOS 6~11.

Usage

// Get keyboard manager
YYKeyboardManager *manager = [YYKeyboardManager defaultManager];
	
// Get keyboard view and window
UIView *view = manager.keyboardView;
UIWindow *window = manager.keyboardWindow;
	
// Get keyboard status
BOOL visible = manager.keyboardVisible;
CGRect frame = manager.keyboardFrame;
frame = [manager convertRect:frame toView:self.view];
	
// Track keyboard animation
[manager addObserver:self];
- (void)keyboardChangedWithTransition:(YYKeyboardTransition)transition {
    CGRect fromFrame = [manager convertRect:transition.fromFrame toView:self.view];
    CGRect toFrame =  [manager convertRect:transition.toFrame toView:self.view];
    BOOL fromVisible = transition.fromVisible;
    BOOL toVisible = transition.toVisible;
    NSTimeInterval animationDuration = transition.animationDuration;
    UIViewAnimationCurve curve = transition.animationCurve;
}Copy the code

Installation

CocoaPods

  1. Add pod 'YYKeyboardManager' to your Podfile.
  2. Run pod install or pod update.
  3. Import <YYKeyboardManager/YYKeyboardManager.h>.

Carthage

  1. Add github "ibireme/YYKeyboardManager" to your Cartfile.
  2. Run carthage update --platform ios and add the framework to your project.
  3. Import <YYKeyboardManager/YYKeyboardManager.h>.

Manually

  1. Download all the files in the YYKeyboardManager subdirectory.
  2. Add the source files to your Xcode project.
  3. Import YYKeyboardManager.h.

Documentation

Full API documentation is available on CocoaDocs.

You can also install documentation locally using appledoc.

Requirements

This library requires iOS 6.0+ and Xcode 8.0+.

License

YYKeyboardManager is provided under the MIT license. See LICENSE file for details.





Chinese is introduced

IOS keyboard monitor management tool class. (This tool is a separate component extracted from YYText)

compatibility

The project is compatible with iPhone/iPad/iPod, iOS 6~11, and can handle screen rotation well.

usage

YYKeyboardManager *manager = [YYKeyboardManager defaultManager]; // Get the view and window UIView *view = manager.keyboardView; UIWindow *window = manager.keyboardWindow; BOOL visible = manager.keyboardVisible; CGRect frame = manager.keyboardFrame; frame = [manager convertRect:frame toView:self.view]; // Listen for keyboard animation [manager addObserver:self]; - (void)keyboardChangedWithTransition:(YYKeyboardTransition)transition { CGRect fromFrame = [manager convertRect:transition.fromFrame toView:self.view]; CGRect toFrame = [manager convertRect:transition.toFrame toView:self.view]; BOOL fromVisible = transition.fromVisible; BOOL toVisible = transition.toVisible; NSTimeInterval animationDuration = transition.animationDuration; UIViewAnimationCurve curve = transition.animationCurve; }Copy the code

The installation

CocoaPods

  1. Add to Podfilepod 'YYKeyboardManager'.
  2. performpod installpod update.
  3. Import < YYKeyboardManager/YYKeyboardManager. H >.

Carthage

  1. Add in Cartfilegithub "ibireme/YYKeyboardManager".
  2. performcarthage update --platform iosAnd add the generated framework to your project.
  3. Import < YYKeyboardManager/YYKeyboardManager. H >.

Manual installation

  1. Download everything in the YYKeyboardManager folder.
  2. Add (drag and drop) the source files in YYKeyboardManager to your project.
  3. The importYYKeyboardManager.h.

The document

You can view the API documentation online in CocoaDocs or use AppleDoc to generate the documentation locally.

System requirements

The project supports iOS 6.0 and Xcode 8.0 at a minimum.

license

YYKeyboardManager uses an MIT LICENSE. For details, see the LICENSE file.