首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >ECSlidingViewController与UIScrollView

ECSlidingViewController与UIScrollView
EN

Stack Overflow用户
提问于 2015-03-02 11:08:54
回答 1查看 116关注 0票数 0

我已经设置了ECSlidingViewController,如示例所示。对于标准的viewControllers,它可以正常工作。但是,应用程序的主vc具有以下层次结构:

  1. NavigationController
  2. UIView of ContentController
  3. 此控制器具有水平分页的UIScrollView。
  4. 这个UIScrollView持有n个UICollectionViewController(s)和NHBalancedLayout (垂直)

问题是,panGesture没有被识别,因为当我在scrollView的第一页时,我认为向右的另一个手势会打开slidingViewController?我已经玩过这样的方法了:

代码语言:javascript
运行
复制
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer 
- (BOOL)shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
- (BOOL)shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer

我还看了一下ECSlidingViewcontroller的wiki,但是还没有找到解决方案:-/。这是应用程序的最后一种showStopper :-/。

帮助:-/

这就是我如何将panGesture添加到contentController中的--我为所有的contentControllers创建了一个baseClass:

代码语言:javascript
运行
复制
- (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];
EN

回答 1

Stack Overflow用户

发布于 2015-03-02 17:49:34

好的,找到了一个对我很有用的解决办法。我只是在contentController的左侧添加一个透明视图,将panGesture转发给动态转换委托。如果识别出一个抽头,而不是pan ->,我就要求pan完好无损,在这种情况下,我需要捕获collectionView中相应视图上的抽头。->按预期工作,不会对可用性产生负面影响。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28808306

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档