简体   繁体   English

UIPageViewController具有多个视图并弹跳

[英]UIPageViewController with multiple views and bouncing

I have a UIPageViewController embedded in a ContainerView . 我有一个UIPageViewController嵌入在ContainerView

I have three views for this UIPageViewController : First is green, second is orange, third is blue. 我对此UIPageViewController有三个视图:第一个是绿色,第二个是橙色,第三个是蓝色。 If I'm on first screen and want to go left, there is a bouncing effect. 如果我在第一个屏幕上并想向左走,则会产生弹跳效果。 Same for last screen if I want to go right. 如果我想右移,则与上一个屏幕相同。

This is not a problem for me, but I wonder how to deactivate it? 这对我来说不是问题,但我想知道如何停用它? There is no bounce parameter on the UIPageViewController ... UIPageViewController上没有bounce参数。

More, if I'm on screen 1 (green) and try to go right very quickly, I get to screen 2 (orange), and there is also a bounce, but instead of seeing the beginning of screen 3 (blue) I see a bit of the background (white). 而且,如果我在屏幕1(绿色)上并尝试快速转正,则进入屏幕2(橙色),并且还有反弹,但我没有看到屏幕3(蓝色)的开始有点背景(白色)。 The effect is not nice. 效果不好。

Here is a sample project to show my problem: http://d.pr/f/QVXK 这是显示我的问题的示例项目: http : //d.pr/f/QVXK

In short: is there a way to 简而言之:有没有办法

  • totally disable bouncing for UIPageViewController 完全禁用UIPageViewController弹跳
  • disable bouncing only between views of UIPageViewController but keep it for first and last view ? 禁用仅在UIPageViewController视图之间UIPageViewController但将其保留为第一个和最后一个视图?

Thanks a lot, hope I'm clear enough ! 非常感谢,希望我足够清楚!

PS I also tested https://github.com/ykyuen/ScrollViewWithPaging and I don't see the same thing... Is that because they instantiated all the views at first in an array, and my app just instantiates it when needed? PS我还测试了https://github.com/ykyuen/ScrollViewWithPaging ,但我看不到相同的东西……是因为它们首先在数组中实例化了所有视图,而我的应用程序仅在需要时实例化了吗?

actually the code(at gitHub) you are giving does not using UIPgeviewController its just representation of scrollview as page view even you can see that this code is not using dataSource function of pageiew controller and one more thing i want to say that whatever you are doing in your code is logical and rest of things are depending on the need. 实际上,您提供的代码(位于gitHub处)并未使用UIPgeviewController并将其只是滚动视图表示为页面视图,即使您可以看到此代码未使用pageiew控制器的dataSource函数,还有一件事我想说的是在您的代码中是合乎逻辑的,其他事情取决于需要。 may be you can use that code in your project if you want to do. 也许您可以在项目中使用该代码。

what ever you are doing is just a feature of UIPageViewController. 您所做的只是UIPageViewController的功能。 UIPageViewController showing as the same way you see. UIPageViewController显示方式与您看到的方式相同。

if you want to remove that bouncing you can use UIPageViewControllerTransitionStylePageCurl style 如果要删除该弹跳,可以使用UIPageViewControllerTransitionStylePageCurl样式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM