我有一个 UIScrollView,其中包含一个 UIView,该 UIView 还包含一行 UIButton。我最近注意到,当用户通过触摸 UIScrollView 左右滚动时,会出现即时延迟。有时 UIButton 会检测到滑动并且似乎激活了按钮。
- (void)setupScreen {
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height;
[self.view setFrame:CGRectMake(0, 0, screenWidth, screenHeight)];
[self.view addSubview:self.scrollViewControls];
[self.scrollViewControls setFrame:CGRectMake(0, self.view.frame.size.height - self.scrollViewControls.frame.size.height, self.view.frame.size.width, self.scrollViewControls.frame.size.height)];
[self.scrollViewControls addSubview:self.viewControls];
[self.scrollViewControls setContentSize:CGSizeMake(self.viewControls.frame.size.width, self.viewControls.frame.size.height)];
[self.scrollViewControls setBackgroundColor:[self colorWithHexString:@"333a44"]];
self.scrollViewControls.delaysContentTouches = NO;
self.imageCache = [[NSMutableDictionary alloc] init];
[self setupImage];
}
我在 iOS 7 中没有注意到这个问题,它似乎在 iOS 8 中。所有按钮在按下时都设置为 Touch Inside。
知道如何纠正这个问题吗?
最佳答案
scrollView.delaysContentTouches = NO
关于ios - 使用 UIScrollView 和多个 UIButtons 延迟滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26301243/