我已经设置了ECSlidingViewController,如示例所示。它对标准viewControllers没有问题。但是应用程序的主要vc具有以下层次结构:
问题是panGesture无法识别,因为当我在scrollView的第一页上时,我认为它只是工作,右边的另一个手势打开了slidingViewController?我已经玩过类似的方法:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
- (BOOL)shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
- (BOOL)shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
我还看了一下ECSlidingViewcontroller wiki - 但是还没有找到解决方案: - /。 它是应用程序的最后一种showStopper: - /。
帮助: - /
这就是我如何将panGesture添加到contentController - 我有一个适用于所有contentControllers的baseClass:
- (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];
答案 0 :(得分:1)
确定找到了一个对我来说非常好的解决方法。我只是在contentController的左边添加一个透明视图,我将panGesture转发给动态转换委托。如果识别出点击而不是泛 - >我要求pan gesturerec在这种情况下失败,以捕获collectionView中相应视图的点击。 - &GT;按预期工作,对可用性没有负面影响。