0

我有UIViewController一个UIScrollView在里面。在模拟器中运行时,我拖动它UIScrollView并且它开始正确移动,但是当我释放拖动时,有一个小的延迟(大约半秒)然后视图继续移动以完成动量。

此延迟仅在视图中发生触摸释放时发生。因此,如果我在模拟器外拖动并释放,则没有延迟。

这是创建的代码UIScrollView

scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
scrollView.pagingEnabled = YES;
scrollView.showsHorizontalScrollIndicator = NO;
//scrollView.delaysContentTouches = NO;
//scrollView.userInteractionEnabled = YES;
scrollView.delegate = self;
[self.view addSubview:scrollView];

// Add some sub views here
// ...

// 2 pages
scrollView.contentSize = CGSizeMake(self.view.frame.size.width*2, self.view.frame.size.height);
  • 我没有覆盖应用程序中的任何触摸事件。
  • 我还没有实现任何 UIScrollViewDelegate 方法。
  • 启用和禁用分页没有区别。
  • 我没有在物理设备上运行它,只是在模拟器中。

有什么问题?

谢谢。

4

1 回答 1

1

回答我自己的问题以防其他人想知道。

这是在 MacBook 上使用触摸板的副作用。在进行三指拖动时,操作系统会在释放后添加延迟,以便您将手指抬起并快速放回以继续拖动。使用鼠标时不会发生这种情况。

代码或模拟器没有问题。

傻我:)

于 2014-09-19T15:22:06.557 回答