【问题标题】:Delay With Scroll Using UIScrollView & Multiple UIButtons使用 UIScrollView 和多个 UIButtons 滚动延迟
【发布时间】:2014-12-05 17:32:27
【问题描述】:

我有一个 UIScrollView,它包含一个 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。

知道如何纠正这个问题吗?

【问题讨论】:

    标签: ios uiscrollview uibutton ios8


    【解决方案1】:

    scrollView.delaysContentTouches = NO

    【讨论】:

      【解决方案2】:

      搜索后这是我的滚动问题的最佳解决方案。

      See Answer

      【讨论】:

      • 不鼓励仅链接答案。如果链接断开,则答案对其他用户无用。
      猜你喜欢
      • 1970-01-01
      • 2013-05-31
      • 2014-09-14
      • 2023-04-04
      • 2012-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多