如果我设置了负偏移,则双击不起作用。我的代码如下: (如果> = 0则双击工作)
self.doubleTap = [[UITapGestureRecognizer alloc] initWithTarget: self action:@selector(doDoubleTap:)];
self.doubleTap.numberOfTapsRequired = 2;
[self.view addGestureRecognizer:self.doubleTap];
//Some where
scrollView.contentOffset=CGPointMake(-(self.scrView.frame.size.width-self.objDrawingView.frame.size.width)/2.0, -(self.scrView.frame.size.height-self.objDrawingView.frame.size.height)/2.0);
感谢您的帮助!
答案 0 :(得分:0)
您需要在superview中添加tapgesture以获取层次结构手势,就像这里是滚动视图一样。
答案 1 :(得分:0)
尝试在视图中添加以下行,然后在设置内容偏移
之前加载[self setAutomaticallyAdjustsScrollViewInsets:NO];