react-native-navigation的迁移库

MMDrawerController+Subclass.h 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. // Copyright (c) 2013 Mutual Mobile (http://mutualmobile.com/)
  2. //
  3. // Permission is hereby granted, free of charge, to any person obtaining a copy
  4. // of this software and associated documentation files (the "Software"), to deal
  5. // in the Software without restriction, including without limitation the rights
  6. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. // copies of the Software, and to permit persons to whom the Software is
  8. // furnished to do so, subject to the following conditions:
  9. //
  10. // The above copyright notice and this permission notice shall be included in
  11. // all copies or substantial portions of the Software.
  12. //
  13. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. // THE SOFTWARE.
  20. #import "MMDrawerController.h"
  21. /**
  22. This class extension is designed for use by subclasses of `MMDrawerController` to customize the functionality to support a specific use-case by a developer. When importing this file, there is no need to also call `#import MMDrawerController.h`.
  23. None of these methods are meant to be called by non-subclasses of `MMDrawerController`.
  24. */
  25. @interface MMDrawerController (Subclass)
  26. ///---------------------------------------
  27. /// @name Gesture Interaction
  28. ///---------------------------------------
  29. /**
  30. `MMDrawerController`'s single-tap gesture recognizer callback. This method is called every time the `UITapGestureRecognizer` is triggered.
  31. @param tapGesture The single-tap gesture recognizer instance that triggered the callback
  32. */
  33. -(void)tapGestureCallback:(UITapGestureRecognizer *)tapGesture __attribute((objc_requires_super));
  34. /**
  35. `MMDrawerController`'s pan gesture recognizer callback. This method is called every time the `UIPanGestureRecognizer` is updated.
  36. @warning This method do the minimal amount of work to keep the pan gesture responsive.
  37. @param panGesture The pan gesture recognizer instance that triggered the callback
  38. */
  39. -(void)panGestureCallback:(UIPanGestureRecognizer *)panGesture __attribute((objc_requires_super));
  40. /**
  41. A `UIGestureRecognizerDelegate` method that is queried by `MMDrawerController`'s gestures to determine if it should receive the touch.
  42. @param gestureRecognizer The gesture recognizer that is asking if it should recieve a touch
  43. @param touch The touch in question in gestureRecognizer.view's coordinate space
  44. */
  45. -(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch __attribute((objc_requires_super));
  46. ///---------------------------------------
  47. /// @name Drawer Presentation
  48. ///---------------------------------------
  49. /**
  50. Sets the initial conditions for `MMDrawerController` and its child view controllers to prepare the drawer for a transition. If a drawer is open and the opposite drawer is being presented, it prepares that drawer to be hidden and vice-versa for the closing drawer.
  51. @param drawer The drawer side that will be presented
  52. @param animated A boolean that indicates whether the presentation is being animated or not
  53. */
  54. -(void)prepareToPresentDrawer:(MMDrawerSide)drawer animated:(BOOL)animated __attribute((objc_requires_super));
  55. ///---------------------------------------
  56. /// @name Opening/Closing Drawer
  57. ///---------------------------------------
  58. /**
  59. The method that handles closing the drawer. You can subclass this method to get a callback every time the drawer is about to be closed. You can inspect the current open side to determine what side is about to be closed.
  60. @param animated A boolean that indicates whether the drawer should close with animation
  61. @param velocity A float indicating how fast the drawer should close
  62. @param animationOptions A mask defining the animation options of the animation
  63. @param completion A completion block to be called when the drawer is finished closing
  64. */
  65. -(void)closeDrawerAnimated:(BOOL)animated velocity:(CGFloat)velocity animationOptions:(UIViewAnimationOptions)options completion:(void (^)(BOOL))completion __attribute((objc_requires_super));
  66. /**
  67. The method that handles opening the drawer. You can subclass this method to get a callback every time the drawer is about to be opened.
  68. @param drawerSide The drawer side that will be opened
  69. @param animated A boolean that indicates whether the drawer should open with animation
  70. @param velocity A float indicating how fast the drawer should open
  71. @param animationOptions A mask defining the animation options of the animation
  72. @param completion A completion block to be called when the drawer is finished opening
  73. */
  74. -(void)openDrawerSide:(MMDrawerSide)drawerSide animated:(BOOL)animated velocity:(CGFloat)velocity animationOptions:(UIViewAnimationOptions)options completion:(void (^)(BOOL))completion __attribute((objc_requires_super));
  75. ///---------------------------------------
  76. /// @name `UIViewController` Subclass Methods
  77. ///---------------------------------------
  78. /**
  79. Included here to ensure subclasses call `super`.
  80. @param toInterfaceOrientation The interface orientation that the interface is moving to
  81. @param duration The duration of the interface orientation animation
  82. */
  83. -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration __attribute((objc_requires_super));
  84. /**
  85. Included here to ensure subclasses call `super`.
  86. @param toInterfaceOrientation The interface orientation that the interface is moving to
  87. @param duration The duration of the interface orientation animation
  88. */
  89. -(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration __attribute((objc_requires_super));
  90. @end