ios - 使用 UIScrollView 和多个 UIButtons 延迟滚动

标签 ios uiscrollview uibutton ios8

我有一个 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/

相关文章:

ios - NSNumber 与 0 转换为 NSInteger/NSUInteger 变为 nil

ios - 如何显示日期时间选择器并在文本字段中设置所选值

ios - UIButton 在 UITableview 中不起作用

ios - Swift:在更新标签时展开可选值时意外发现 nil

objective-c - 为我的 iPhone 应用程序使用 xcode 4.2 编译链接错误

ios - 在 UICollectionView 的两个方向上无限滚动,带有部分

iphone - super View 如何在其任何 subview 之前拦截触摸序列?

ios - 动态 ScrollView Swift

ios - 如何使用图像和标签制作自定义正确的 UIBarButtonItem?

swift - 当按钮覆盖在 tableview 顶部时,如何防止 tableview 单元格注册点击?