Geen omschrijving

ZYKeyboardUtil.h 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // ZYKeyboardUtil.h
  3. // ZYKeyboardUtil
  4. //
  5. // Created by lzy on 15/12/26.
  6. // Copyright © 2015年 lzy . All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. static CGFloat const DURATION_ANIMATION = 0.5f;
  11. typedef enum {
  12. KeyboardActionDefault,
  13. KeyboardActionShow,
  14. KeyboardActionHide
  15. }KeyboardAction;
  16. @protocol KeyboardUtilProtocol <NSObject>
  17. - (void)adaptiveViewHandleWithController:(UIViewController *)viewController adaptiveView:(UIView *)adaptiveView, ...NS_REQUIRES_NIL_TERMINATION;
  18. @end
  19. #pragma mark - KeyboardInfo(model)
  20. @interface KeyboardInfo : NSObject
  21. @property (assign, nonatomic) CGFloat animationDuration;
  22. @property (assign, nonatomic) CGRect frameBegin;
  23. @property (assign, nonatomic) CGRect frameEnd;
  24. @property (assign, nonatomic) CGFloat heightIncrement;
  25. @property (assign, nonatomic) KeyboardAction action;
  26. @property (assign, nonatomic) BOOL isSameAction;
  27. - (void)fillKeyboardInfoWithDuration:(CGFloat)duration frameBegin:(CGRect)frameBegin frameEnd:(CGRect)frameEnd heightIncrement:(CGFloat)heightIncrement action:(KeyboardAction)action isSameAction:(BOOL)isSameAction;
  28. @end
  29. #pragma mark - ZYKeyboardUtil
  30. @interface ZYKeyboardUtil : NSObject<KeyboardUtilProtocol>
  31. //Block
  32. typedef void (^animateWhenKeyboardAppearBlock)(int appearPostIndex, CGRect keyboardRect, CGFloat keyboardHeight, CGFloat keyboardHeightIncrement);
  33. typedef void (^animateWhenKeyboardDisappearBlock)(CGFloat keyboardHeight);
  34. typedef void (^printKeyboardInfoBlock)(ZYKeyboardUtil *keyboardUtil, KeyboardInfo *keyboardInfo);
  35. typedef void (^animateWhenKeyboardAppearAutomaticAnimBlock)(ZYKeyboardUtil *keyboardUtil);
  36. - (void)setAnimateWhenKeyboardAppearBlock:(animateWhenKeyboardAppearBlock)animateWhenKeyboardAppearBlock;
  37. - (void)setAnimateWhenKeyboardAppearAutomaticAnimBlock:(animateWhenKeyboardAppearAutomaticAnimBlock)animateWhenKeyboardAppearAutomaticAnimBlock;
  38. - (void)setAnimateWhenKeyboardDisappearBlock:(animateWhenKeyboardDisappearBlock)animateWhenKeyboardDisappearBlock;
  39. - (void)setPrintKeyboardInfoBlock:(printKeyboardInfoBlock)printKeyboardInfoBlock;
  40. @end