Skip to content

Commit

Permalink
解决pod头文件相互依赖问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Gdxy committed Nov 30, 2018
1 parent 1774416 commit 570ffd5
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 20 deletions.
1 change: 0 additions & 1 deletion TLTransitions.podspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Pod::Spec.new do |s|
s.name = 'TLTransitions'
s.version = '1.4.3'
Expand Down
2 changes: 1 addition & 1 deletion TLTransitions/TLTransitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#import "TLTransition.h"
#import "UIViewController+Transitioning.h"
#import "TLGlobalConfig.h"
#import "TLSystemAnimator.h"
#import "TLAnimatorProtocol.h"
#import "TLSystemAnimator.h"
#import "TLSwipeAnimator.h"
#import "TLCATransitonAnimator.h"
#import "TLCustomAnimator.h"
Expand Down
11 changes: 7 additions & 4 deletions TLTransitions/TransitionController/Animator/TLAnimator.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
// 个人收集的一些动画

#import "TLAnimator.h"
#import "UIViewController+Transitioning.h"
#import "TLTransitionDelegate.h"
//#import "UIViewController+Transitioning.h"
//#import "TLTransitionDelegate.h"

typedef void(^TLAnimationCompletion)(BOOL flag);

Expand Down Expand Up @@ -680,8 +680,11 @@ - (void)dismissPanGestureRecognizerOfSlidingDrawerType:(UIPanGestureRecognizer *
UIView *snapshot = [containerView viewWithTag:100];
CGPoint locationInSourceView = [pan locationInView:containerView];
if (CGRectContainsPoint(snapshot.frame, locationInSourceView)) {
_presentedViewController.transitionDelegate.tempInteractiveDirection = TLDirectionToLeft;
_presentedViewController.transitionDelegate.interactiveRecognizer = pan;
// 使用KVO解决pod中头文件的循环依赖
[_presentedViewController setValue:@(TLDirectionToLeft) forKeyPath:@"transitionDelegate.tempInteractiveDirection"];
[_presentedViewController setValue:pan forKeyPath:@"transitionDelegate.interactiveRecognizer"];
// _presentedViewController.transitionDelegate.tempInteractiveDirection = TLDirectionToLeft;
// _presentedViewController.transitionDelegate.interactiveRecognizer = pan;
[_presentedViewController dismissViewControllerAnimated:YES completion:nil];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#import "TLAnimatorProtocol.h"

//#ifdef NO_BUILDING // 本文件不参与编译
#ifdef NO_BUILDING // 本文件不参与编译
NS_ASSUME_NONNULL_BEGIN

@interface TLAnimatorTemplate : NSObject <TLAnimatorProtocol>
Expand All @@ -18,4 +18,4 @@ NS_ASSUME_NONNULL_BEGIN
@end
NS_ASSUME_NONNULL_END

//#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#import "TLAnimatorTemplate.h"

//#ifdef NO_BUILDING // 本文件不参与编译
#ifdef NO_BUILDING // 本文件不参与编译
@implementation TLAnimatorTemplate

#pragma mark - TLAnimatorProtocol (必须实现的协议内容)
Expand Down Expand Up @@ -112,5 +112,5 @@ - (void)animateTransition:(nonnull id<UIViewControllerContextTransitioning>)tran

@end

//#endif
#endif

Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
// Copyright © 2018 故乡的云. All rights reserved.
// CATransition Animator

#import "TLGlobalConfig.h"
//#import "TLAnimatorProtocol.h"
#import "TLAnimatorProtocol.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
// Copyright © 2018 故乡的云. All rights reserved.
// 滑动边缘区域进入和退出

#import "TLGlobalConfig.h"
//#import "TLAnimatorProtocol.h"
#import "TLAnimatorProtocol.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
// Copyright © 2018 故乡的云. All rights reserved.
// 系统动画,只支持modal

#import "TLGlobalConfig.h"
//#import "TLAnimatorProtocol.h"
#import "TLAnimatorProtocol.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ - (void)interactivePushRecognizerAction:(UIPanGestureRecognizer *)gestureRecogni
}

if (animator.isPushOrPop){
BOOL falg = ![self isMemberOfClass:[UINavigationController class]]; // 不能是UINavigationController
NSAssert(falg, @"%s 方法n不能用UINavigationController发起调用,请直接用view controllerd调用", __func__);
NSAssert(![self isMemberOfClass:[UINavigationController class]], @"%s 方法n不能用UINavigationController发起调用,请直接用view controllerd调用", __func__);
NSAssert(self.navigationController, (@"控制器 %@ 没有navigationController,无法push"), self);
NSAssert(![animator isMemberOfClass:[TLSystemAnimator class]], (@"TLSystemAnimator 只支持modal"), self);
[self.navigationController pushViewController:self.willPresentViewController animated:YES];
Expand Down Expand Up @@ -269,8 +268,8 @@ - (void)presentViewController:(UIViewController *)vc
#pragma mark - Push / pop
- (void)pushViewController:(UIViewController *)viewController animator:(id<TLAnimatorProtocol>)animator
{
BOOL falg = ![self isMemberOfClass:[UINavigationController class]]; // 不能是UINavigationController
NSAssert(falg, @"%s 方法n不能用UINavigationController发起调用,请直接用view controllerd调用", __func__);
// 不能是UINavigationController
NSAssert(![self isMemberOfClass:[UINavigationController class]], @"%s 方法n不能用UINavigationController发起调用,请直接用view controllerd调用", __func__);
NSAssert(self.navigationController, (@"控制器 %@ 没有navigationController,无法push"), self);
NSAssert(![animator isMemberOfClass:[TLSystemAnimator class]], (@"TLSystemAnimator 只支持modal"), self);

Expand Down

0 comments on commit 570ffd5

Please sign in to comment.