Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.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
Ios can';在setContentOffset之后不能与UIScrollView交互_Ios_Objective C_Cocoa Touch_Uiscrollview - Fatal编程技术网

Ios can';在setContentOffset之后不能与UIScrollView交互

Ios can';在setContentOffset之后不能与UIScrollView交互,ios,objective-c,cocoa-touch,uiscrollview,Ios,Objective C,Cocoa Touch,Uiscrollview,在我的应用程序中,我有一个小区域可以拖动手指,并相应地移动一个更大的UIScrollView。UIScrollView中有许多按钮 ---*---*---*- 滚动视图 ----容器 --------钮扣 --------钮扣 --------钮扣 这非常有效,UIScrollView按应有的方式移动,问题是在我完成拖动后,UIScrollView对点击没有响应。如果我按一下按钮,什么也不会发生。如果我在实际的UIScrollView上做一点滑动,它将重置到其原始位置,并再次对点击做出响应 我很

在我的应用程序中,我有一个小区域可以拖动手指,并相应地移动一个更大的
UIScrollView
UIScrollView
中有许多按钮

---*---*---*-

滚动视图

----容器

--------钮扣

--------钮扣

--------钮扣

这非常有效,
UIScrollView
按应有的方式移动,问题是在我完成拖动后,
UIScrollView
对点击没有响应。如果我按一下按钮,什么也不会发生。如果我在实际的
UIScrollView
上做一点滑动,它将重置到其原始位置,并再次对点击做出响应

我很确定这是容器故障(删除它并将按钮添加到
UIScrollView
非常有效),但我需要具备缩放功能,我知道的唯一方法是将容器添加到scrollview

- (void)draging:(UIControl *)c withEvent:ev {
    UITouch *touch = [[ev allTouches] anyObject];
    currentTouchPoint = [touch locationInView:self.view];
    NSLog(@"Draging x : %f y : %f", currentTouchPoint.x, currentTouchPoint.y);
   [_myScrollView setContentOffset:CGPointMake(currentTouchPoint.x*4, currentTouchPoint.y*2) animated:YES];
}

我最终对UIScrollView进行了子类化,并使用了以下方法:

#import "scrollViewWithButtons.h"

@implementation scrollViewWithButtons

- (BOOL)touchesShouldCancelInContentView:(UIView *)view
{
    return ![view isKindOfClass:[UIButton class]];
}

@end