FullscreenPopGestureRecognizer.h 3.54 KB
//
//  FullscreenPopGestureRecognizer.h
//  BBAPods
//
//  Created by qfu on 3/30/16.
//  Copyright © 2016 Baidu. All rights reserved.
//

#import <UIKit/UIKit.h>


@interface FullscreenPopGestureRecognizer : NSObject

/**
 全屏手势
 */
@property (nullable, nonatomic,weak) UIPanGestureRecognizer *popRecognizer;

/**
 边缘手势
 */
@property (nullable, nonatomic,weak) UIScreenEdgePanGestureRecognizer *edgePopRecognizer;

/**
 全屏手势开关
 */
@property (nonatomic,assign) BOOL enabled;

/**
 是否已经处于手势过程中(手势)
 */
@property (nonatomic,assign) BOOL popActionDidStart;

/**
 是否已经处于手势过程中(手势+动画)
 */
@property (nonatomic,assign) BOOL isTransiting;

/**
 全屏手势响应默认值
 */
@property (nonatomic,assign) BOOL defaultFullGesterShouldRecognizer;

/**
 全屏手势初始化
 */
- (nullable instancetype)initWithNavigationController:(nonnull UINavigationController *)controller;

/**
 用于手势期间获取栈内元素
 */
- (nullable UIViewController *)bbaAnimationTopViewController;

/**
 用于手势期间获取栈内元素
 */
- (nullable UIViewController *)bbaTopViewController;

/**
 * @brief 处于手势过程中(手势+动画)topVC
 *
 * @return vc
 */
- (nullable UIViewController *)bbaTransitingTopViewController;

/**
 用于手势期间获取栈内元素
 */
- (nullable NSArray<__kindof UIViewController *> *)bbaViewControllers;

@end


#pragma mark - 针对VC的控制
@protocol BBAFullscreenPopGestureProtocol<NSObject>

@optional

/**
 支持全屏返回手势
 */
- (BOOL)supportFullscreenPopGesture;

/**
 支持边缘返回手势
 */
- (BOOL)supportEdgePopGesture;

/**
 边缘侧滑返回手势是否被禁用(废弃)
 */
- (BOOL)disablePopGesture NS_DEPRECATED_IOS(1_0, 1_0, "10.3已废弃, 请使用supportEdgePopGesture");

/**
 全屏返回手势支持同时响应
 */
- (BOOL)fullscreenPopGestureShouldRecognizeSimultaneously;

/**
 边缘返回手势支持同时响应
 */
- (BOOL)edgePopGestureShouldRecognizeSimultaneously;

/**
 接收到touch事件时是否响应全屏手势
 */
- (BOOL)fullscreenPopGestureShouldReceiveTouch:(nullable UITouch *)touch;

/**
 接收到touch事件时是否响应边缘手势
 */
- (BOOL)edgePopGestureShouldReceiveTouch:(nullable UITouch *)touch;

/**
 全屏手势冲突处理(是否取消otherGesture)
 */
- (BOOL)fullscreenPopGesture:(nullable UIGestureRecognizer *)popGesture shouldBeRequiredToFailByGestureRecognizer:(nullable UIGestureRecognizer *)otherGesture;

/**
 边缘手势冲突处理(是否取消otherGesture)
 */
- (BOOL)edgePopGesture:(nullable UIGestureRecognizer *)popGesture shouldBeRequiredToFailByGestureRecognizer:(nullable UIGestureRecognizer *)otherGesture;

/**
 将要开启返回手势(top viewcontroller)
 */
- (void)fullscreenPopGestureWillPopAnimation;

/**
 是否取消将要完成的返回手势(top viewcontroller)
 */
- (BOOL)isCancelWillFinishPopAnimation;

/**
 将要完成返回手势(top viewcontroller)
 */
- (void)fullscreenPopGestureWillFinishPopAnimation;

/**
 将要取消返回手势(top viewcontroller)
 */
- (void)fullscreenPopGestureWillCancelPopAnimation;

/**
 已经完成返回手势(top viewcontroller)
 */
- (void)fullscreenPopGestureDidFinishPopAnimation;

/**
 已经取消返回手势(top viewcontroller)
 */
- (void)fullscreenPopGestureDidCancelPopAnimation;

@end


#pragma mark - 针对View的控制
@protocol BBAFullscreenPopGestureInViewProtocol<NSObject>

/**
 支持全屏返回手势
 */
- (BOOL)supportFullscreenPopGesture;

/**
 支持边缘返回手势
 */
- (BOOL)supportEdgePopGesture;

@end