FWAnimatedTransition


@interface FWAnimatedTransition
    : UIPercentDrivenInteractiveTransition <
          UIViewControllerAnimatedTransitioning,
          UIViewControllerTransitioningDelegate, UINavigationControllerDelegate>

转场动画类,默认透明度变化

Public

  • 创建系统转场单例,不支持交互手势转场

    Declaration

    Objective-C

    + (nonnull instancetype)systemTransition;
  • 创建动画句柄转场

    Declaration

    Objective-C

    + (nonnull instancetype)transitionWithBlock:
        (nullable void (^)(FWAnimatedTransition *_Nonnull __strong))block;
  • 设置动画句柄

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^) (FWAnimatedTransition *_Nonnull __strong) transitionBlock;
  • 动画持续时间,必须大于0,默认0.35秒(默认设置completionSpeed为0.35)

    Declaration

    Objective-C

    @property (nonatomic) NSTimeInterval transitionDuration;
  • 获取动画类型,默认根据上下文判断

    Declaration

    Objective-C

    @property (nonatomic) FWAnimatedTransitionType transitionType;

Interactive

  • 是否启用交互pan手势进行pop|dismiss,默认NO。可使用父类属性设置交互动画

    Declaration

    Objective-C

    @property (nonatomic) BOOL interactEnabled;
  • 是否启用screenEdge交互手势,默认NO,gestureRecognizer加载前设置生效

    Declaration

    Objective-C

    @property (nonatomic) BOOL interactScreenEdge;
  • 指定交互pan手势对象,默认FWPanGestureRecognizer,可设置交互方向,滚动视图等

    Declaration

    Objective-C

    @property (nonatomic, strong) __kindof UIPanGestureRecognizer *_Nonnull gestureRecognizer;
  • 是否正在交互中,手势开始才会标记为YES,手势结束标记为NO

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL isInteractive;
  • 自定义交互句柄,可根据手势state处理不同状态的交互,返回YES执行默认交互,返回NO不执行。默认为空,执行默认交互

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) BOOL (^) (__kindof UIPanGestureRecognizer *_Nonnull __strong) interactBlock;
  • 自定义dismiss关闭动画完成回调,默认nil

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^)(void) dismissCompletion;
  • 手工绑定交互控制器,添加pan手势,需要vc.view存在时调用才生效。默认自动绑定,如果自定义interactBlock,必须手工绑定

    Declaration

    Objective-C

    - (void)interactWith:(nonnull UIViewController *)viewController;

Presentation

  • 是否启用默认展示控制器,启用后自动设置presentationBlock返回FWPresentationController,默认NO

    Declaration

    Objective-C

    @property (nonatomic) BOOL presentationEnabled;
  • 设置展示控制器创建句柄,自定义弹出效果。present时建议设置modalPresentationStyle为Custom

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) UIPresentationController *_Nonnull (^)(UIViewController *_Nonnull __strong, UIViewController *_Nonnull __strong) presentationBlock;

Animate

  • 转场上下文,只读

    Declaration

    Objective-C

    @property (nonatomic, weak, readonly, nullable) id<UIViewControllerContextTransitioning> transitionContext;
  • 标记动画开始(自动添加视图到容器)

    Declaration

    Objective-C

    - (void)start;
  • 执行动画,子类重写,可选

    Declaration

    Objective-C

    - (void)animate;
  • 自动标记动画完成(根据transitionContext是否被取消判断)

    Declaration

    Objective-C

    - (void)complete;