我已经设置了 ECSlidingViewController,如示例中所示。它适用于标准视图控制器没有问题。但是应用程序的主vc具有以下层次结构:
- 导航控制器
- ContentController 的 UIView
- 这个控制器持有一个 UIScrollView 水平分页
- 这个 UIScrollView 持有 n UICollectionViewController(s) 和 NBalancedLayout (vertical)
问题是 panGesture 无法识别,因为当我在 scrollView 的第一页上时,我认为向右的另一个手势打开slidingViewController 会起作用?我已经玩过以下方法:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
- (BOOL)shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
- (BOOL)shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
我还查看了 ECSlidingViewcontroller wiki - 但还没有找到解决方案:-/。它是应用程序的最后一种 showStopper :-/。
帮助 :-/
这就是我将 panGesture 添加到 contentController 的方式 - 我有一个用于所有 contentController 的基类:
- (void)viewDidLoad
[super viewDidLoad];
// Do any additional setup after loading the view.
self.transitions.dynamicTransition.slidingViewController = self.slidingViewController;
NSDictionary *transitionData = self.transitions.all[0];
id<ECSlidingViewControllerDelegate> transition = transitionData[@"transition"];
self.slidingViewController.delegate = transition;
self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGestureTapping | ECSlidingViewControllerAnchoredGestureCustom;
self.slidingViewController.customAnchoredGestures = @[self.dynamicTransitionPanGesture];
[self.navigationController.view addGestureRecognizer:self.dynamicTransitionPanGesture];