Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/43.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone UISwipegestureRecognitor和UIScrollView_Iphone_Ios_Uiscrollview_Uigesturerecognizer - Fatal编程技术网

Iphone UISwipegestureRecognitor和UIScrollView

Iphone UISwipegestureRecognitor和UIScrollView,iphone,ios,uiscrollview,uigesturerecognizer,Iphone,Ios,Uiscrollview,Uigesturerecognizer,我有一个垂直滚动视图(不可能水平滚动),默认情况下我的选项卡栏是隐藏的。但是,您可以通过在屏幕底部区域向上滑动,将选项卡栏向上拉。(内容需要大量垂直空间) 我的困境是:我希望能够在scrollview的底部区域检测到向上滑动的手势,而不会使scrollview向下滚动。所以我想在底部区域放置一个透明的视图,只检测到向上滑动。但问题是,尽管该视图是透明的,但所有my touch事件都会被该视图截获,而不会转发到scrollview 是否可以只向前点击我的scrollview,以便我仍然能够,例如,

我有一个垂直滚动视图(不可能水平滚动),默认情况下我的选项卡栏是隐藏的。但是,您可以通过在屏幕底部区域向上滑动,将选项卡栏向上拉。(内容需要大量垂直空间) 我的困境是:我希望能够在scrollview的底部区域检测到向上滑动的手势,而不会使scrollview向下滚动。所以我想在底部区域放置一个透明的视图,只检测到向上滑动。但问题是,尽管该视图是透明的,但所有my touch事件都会被该视图截获,而不会转发到scrollview

是否可以只向前点击我的scrollview,以便我仍然能够,例如,按下当前位于scrollview底部区域的按钮

我知道这是个奇怪的问题,但我没能找到一个类似的解决方案

我的滚动视图代码:

scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 30, 320, self.view.frame.size.height - 50)];
scrollView.showsVerticalScrollIndicator = YES;
scrollView.tag = 0;
scrollView.backgroundColor = [UIColor clearColor];
scrollView.delegate = self;
scrollView.maximumZoomScale = 1.0;
scrollView.clipsToBounds = NO;
scrollView.minimumZoomScale = 1.0;
scrollView.scrollEnabled = YES;
scrollView.pagingEnabled = YES;
scrollview.contentSize = CGMakeSize(320, xxxx);
UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc]
                                      initWithTarget:self
                                      action:@selector(showTabBar)];
swipeUp.direction = UISwipeGestureRecognizerDirectionUp;
UIView *swipeLayer = [[swipeLayer alloc] initWithFrame:CGRectMake(30, self.view.frame.size.height - 80, 260, 40)];
[hideButtonSwipeActions addGestureRecognizer:swipeUp];
[hideButtonSwipeActions setBackgroundColor:[UIColor clearColor]];
//[hideButtonSwipeActions setUserInteractionEnabled:NO];

...
[swipeUp release];
我的透明视图代码:

scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 30, 320, self.view.frame.size.height - 50)];
scrollView.showsVerticalScrollIndicator = YES;
scrollView.tag = 0;
scrollView.backgroundColor = [UIColor clearColor];
scrollView.delegate = self;
scrollView.maximumZoomScale = 1.0;
scrollView.clipsToBounds = NO;
scrollView.minimumZoomScale = 1.0;
scrollView.scrollEnabled = YES;
scrollView.pagingEnabled = YES;
scrollview.contentSize = CGMakeSize(320, xxxx);
UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc]
                                      initWithTarget:self
                                      action:@selector(showTabBar)];
swipeUp.direction = UISwipeGestureRecognizerDirectionUp;
UIView *swipeLayer = [[swipeLayer alloc] initWithFrame:CGRectMake(30, self.view.frame.size.height - 80, 260, 40)];
[hideButtonSwipeActions addGestureRecognizer:swipeUp];
[hideButtonSwipeActions setBackgroundColor:[UIColor clearColor]];
//[hideButtonSwipeActions setUserInteractionEnabled:NO];

...
[swipeUp release];

非常感谢您的帮助:)

如果您使用触摸的坐标(0480)来跟踪视图底部,可能会这样做?

您是否尝试过将底部UIView的userInteractionEnabled属性设置为否?它应该仍然允许您的滑动识别器工作,但是它应该阻止视图吞噬正常的触摸。

我真的不明白您的要求。你想在scrollview的底部有一个透明的视图,这样你就可以在上面滑动了。我有一个全屏滚动视图,它只垂直滚动。现在,假设您希望能够仅在窗口底部实现向上滑动手势。所以我在scrollview上放置了一个透明视图来接收滑动手势,但它不会将正常的触摸事件转发给scrollview——这就是问题所在。