Skip to content

Commit

Permalink
修复手势注册BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
Gdxy committed Sep 24, 2019
1 parent da217f5 commit 1b461d0
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
26 changes: 26 additions & 0 deletions Example/Example/ModalTransitionContrlller/TLModalMenuController.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ - (void)viewDidLoad {
self.tableView.tableFooterView = [UIView new];

self.automaticallyAdjustsScrollViewInsets = YES;


[self testRegisterInteractiveTransition];
}

- (void)viewDidAppear:(BOOL)animated {
Expand All @@ -49,6 +52,29 @@ - (void)viewDidAppear:(BOOL)animated {
self.tabBarController.tabBar.hidden = NO;
}

- (void)testRegisterInteractiveTransition {
UIViewController *vc = [[UIViewController alloc] init];
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = vc.view.bounds;
gradient.colors = [NSArray arrayWithObjects:
(id)[UIColor redColor].CGColor,
(id)[UIColor greenColor].CGColor,
(id)[UIColor blueColor].CGColor, nil];
gradient.startPoint = CGPointMake(0, 0);
gradient.endPoint = CGPointMake(1, 1);
gradient.locations = @[@0.0, @0.5, @1.0];
[vc.view.layer addSublayer:gradient];

// 注册手势
TLSwipeAnimator *animator = [TLSwipeAnimator animatorWithSwipeType:TLSwipeTypeInAndOut pushDirection:TLDirectionToLeft popDirection:TLDirectionToRight];
animator.transitionDuration = 0.35f;
// 必须初始化的属性
animator.isPushOrPop = NO;
animator.interactiveDirectionOfPush = TLDirectionToLeft;

[self registerInteractiveTransitionToViewController:vc animator:animator];
}

#pragma mark - Table view data source and delegate

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
### pod支持
##### 1. 版本
```
pod 'TLTransitions', '~> 1.4.7'
pod 'TLTransitions', '~> 1.5.0'
```

##### 2. CocoaPods获取不到最新的`TLTransitions`版本问题
Expand Down
2 changes: 1 addition & 1 deletion TLTransitions.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Pod::Spec.new do |s|
s.name = 'TLTransitions'
s.version = '1.4.9'
s.version = '1.5.0'
s.license = 'MIT'
s.ios.deployment_target = '8.0'
s.platform = :ios, '8.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN

/// 转场动画(面向present/push To View Controller)
@property(nonatomic, weak, readonly) TLTransitionDelegate *transitionDelegate;

/// 注册push/present手势后,要转场的控制器
@property(nonatomic, weak, readonly) UIViewController *willPresentViewController;

/** 侧滑pop/dismiss交互手势启用开关。默认开启(NO)
Expand All @@ -44,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN
// NOTE:下面不同类型的Animator实现的转场效果有些类似,只是实现方案有所差异
/**
* present 转场控制器。
* @param viewController 要转场的控制器
* @param viewController 要转场的控制器 对应 willPresentViewController 属性
* @param animator 转场动画管理对象
* 目前提供“TLSystemAnimator”、“TLSwipeAnimator”、“TLCATransitionAnimator”、“TLCuStomAnimator” 、 “TLAnimator”供选择,
* 也可以由开发者自己写一个这样的对象,需要 严格遵守 TLAnimatorProtocal协议(可以参考模版TLAnimatorTemplate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ - (void)registerInteractiveTransitionToViewController:(UIViewController *)viewCo
- (void)interactivePushRecognizerAction:(UIPanGestureRecognizer *)gestureRecognizer {
if (gestureRecognizer.state == UIGestureRecognizerStateBegan) {

if (self.transitionDelegate == nil) {
if (self.willPresentViewController.transitionDelegate == nil) {
return;
}

Expand Down

0 comments on commit 1b461d0

Please sign in to comment.