酷店

UINavigationController+FDFullscreenPopGesture.h 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // The MIT License (MIT)
  2. //
  3. // Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )
  4. //
  5. // Permission is hereby granted, free of charge, to any person obtaining a copy
  6. // of this software and associated documentation files (the "Software"), to deal
  7. // in the Software without restriction, including without limitation the rights
  8. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. // copies of the Software, and to permit persons to whom the Software is
  10. // furnished to do so, subject to the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be included in all
  13. // copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. // SOFTWARE.
  22. #import <UIKit/UIKit.h>
  23. /// "UINavigation+FDFullscreenPopGesture" extends UINavigationController's swipe-
  24. /// to-pop behavior in iOS 7+ by supporting fullscreen pan gesture. Instead of
  25. /// screen edge, you can now swipe from any place on the screen and the onboard
  26. /// interactive pop transition works seamlessly.
  27. ///
  28. /// Adding the implementation file of this category to your target will
  29. /// automatically patch UINavigationController with this feature.
  30. @interface UINavigationController (FDFullscreenPopGesture)
  31. /// The gesture recognizer that actually handles interactive pop.
  32. @property (nonatomic, strong, readonly) UIPanGestureRecognizer *fd_fullscreenPopGestureRecognizer;
  33. /// A view controller is able to control navigation bar's appearance by itself,
  34. /// rather than a global way, checking "fd_prefersNavigationBarHidden" property.
  35. /// Default to YES, disable it if you don't want so.
  36. @property (nonatomic, assign) BOOL fd_viewControllerBasedNavigationBarAppearanceEnabled;
  37. @end
  38. /// Allows any view controller to disable interactive pop gesture, which might
  39. /// be necessary when the view controller itself handles pan gesture in some
  40. /// cases.
  41. @interface UIViewController (FDFullscreenPopGesture)
  42. /// Whether the interactive pop gesture is disabled when contained in a navigation
  43. /// stack.
  44. @property (nonatomic, assign) BOOL fd_interactivePopDisabled;
  45. /// Indicate this view controller prefers its navigation bar hidden or not,
  46. /// checked when view controller based navigation bar's appearance is enabled.
  47. /// Default to NO, bars are more likely to show.
  48. @property (nonatomic, assign) BOOL fd_prefersNavigationBarHidden;
  49. /// Max allowed initial distance to left edge when you begin the interactive pop
  50. /// gesture. 0 by default, which means it will ignore this limit.
  51. @property (nonatomic, assign) CGFloat fd_interactivePopMaxAllowedInitialDistanceToLeftEdge;
  52. @end