Disable UIPageViewController bounce

前端 未结 13 2423
离开以前
离开以前 2020-11-27 04:08

Searched a lot for this one, but couldn\'t find a proper solution yet.

Is it possible to disable the bounce effect of a UIPageViewController and still

13条回答
  •  日久生厌
    2020-11-27 04:44

    UIPageViewController doesn't actually do much for you. You can use a UIScrollView with view controllers quite easily, and disable the bounce on that.

    Just do something like

    int x=0;
    for (NSString *storyboardID in storyboardIDs){
            UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:storyboardID];
            [self addChildViewController:vc];
            vc.view.frame = CGRectMake(x++*vc.view.frame.size.width, 0, vc.view.frame.size.width, vc.view.frame.size.height);
            [self.scrollView addSubview:vc.view];
            [vc didMoveToParentViewController:self];
            self.scrollView.contentSize = CGSizeMake(storyboardIDs.count*vc.view.frame.size.width, vc.view.frame.size.height);
    }
    

提交回复
热议问题