UIPageViewController内的UISlider

UIPageViewController内的UISlider

本文介绍了UIPageViewController内的UISlider的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个按以下方式初始化的PageViewController:

I have a PageViewController which is initialized like this:

self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll
                          navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];

其中一个页面上有一个UISlider。

On one of the pages, there's a UISlider.

我的问题是,当我将transitionstyle设置为 UIPageViewControllerTransitionStyleScroll 时,在 beginTrackingWithTouch 之前需要150-200毫秒在滑块上调用。
当我使用 UIPageViewControllerTransitionStylePageCurl 并立即选择UISlider时,不会看到此行为。

My problem is that when I have transitionstyle set to UIPageViewControllerTransitionStyleScroll, it takes 150-200 ms before beginTrackingWithTouch is invoked on the slider.This behavior is not seen when I use UIPageViewControllerTransitionStylePageCurl, where the UISlider is selected instantly.

此表示除非用户在拖动滑块之前稍等片刻(视频进度),否则页面将转而旋转,这远非理想。

This means that unless the user waits a bit before dragging the slider (a video progress), the page will turn instead, which is far from ideal.

Page curl动画不会不能满足应用程序的要求,因此不胜感激。

The Page curl animation does not meet the demands of the app, so any explanation or workaround is appreciated.

推荐答案

由于没有使用UIPageViewControllerTransitionStyleScroll手势识别器, ,您可以使用:

Since with UIPageViewControllerTransitionStyleScroll gesture recognizers isn't available, you can use this:

for (UIView *view in pageViewController.view.subviews) {
    if ([view isKindOfClass:[UIScrollView class]]) {
        UIScrollView *scrollView = (UIScrollView *)view;
        scrollView.delaysContentTouches = NO;
    }
}

这篇关于UIPageViewController内的UISlider的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 03:58