SwipeView.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // SwipeView.h
  3. // SwipeTableView
  4. //
  5. // Created by zhao on 16/8/29.
  6. // Copyright © 2016年 zhaoName. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. typedef NS_ENUM(NSInteger, MGSwipeEasingFunction) {
  10. MGSwipeEasingFunctionLinear = 0,
  11. MGSwipeEasingFunctionQuadIn,
  12. MGSwipeEasingFunctionQuadOut,
  13. MGSwipeEasingFunctionQuadInOut,
  14. MGSwipeEasingFunctionCubicIn,
  15. MGSwipeEasingFunctionCubicOut,
  16. MGSwipeEasingFunctionCubicInOut,
  17. MGSwipeEasingFunctionBounceIn,
  18. MGSwipeEasingFunctionBounceOut,
  19. MGSwipeEasingFunctionBounceInOut
  20. };
  21. typedef NS_ENUM(NSUInteger, SwipeViewTransfromMode)
  22. {
  23. SwipeViewTransfromModeDefault = 0, /**< 默认效果,拖拽*/
  24. SwipeViewTransfromModeStatic, /**< 静态效果*/
  25. SwipeViewTransfromModeBorder, /**< 渐出效果*/
  26. SwipeViewTransfromMode3D, /**< 3D效果*/
  27. };
  28. @interface SwipeView : UIView
  29. @property (nonatomic, assign) CGFloat from;
  30. @property (nonatomic, assign) CGFloat to;
  31. @property (nonatomic, assign) CFTimeInterval start;
  32. @property (nonatomic, assign) CGFloat duration; /**<动画持续时间 默认0.3*/
  33. @property (nonatomic, assign) MGSwipeEasingFunction easingFunction; /**< 手势动画执行节奏*/
  34. @property (nonatomic, assign) SwipeViewTransfromMode mode;/**< swipeView的弹出效果*/
  35. /**
  36. * 初始化swipeView,添加滑动按钮
  37. */
  38. - (instancetype)initWithButtons:(NSArray *)buttos fromRight:(BOOL)fromRight cellHeght:(CGFloat)cellHeight edge:(UIEdgeInsets)edge;
  39. /**
  40. * 滑动手势滑动的距离超过swipeView的一半时,会自动显示或隐藏swipeView
  41. */
  42. - (CGFloat)value:(CGFloat)elapsed duration:(CGFloat)duration from:(CGFloat)from to:(CGFloat)to;
  43. /**
  44. * swipeView的弹出、隐藏动画
  45. *
  46. * @param fromRight 是否是右滑
  47. * @param t 动画控制量
  48. * @param cellHeight cell的高度
  49. */
  50. - (void)swipeViewAnimationFromRight:(BOOL)fromRight effect:(CGFloat)t cellHeight:(CGFloat)cellHeight;
  51. @end