iOS UIPageViewController 页面控件不同步 [英] iOS UIPageViewController page control getting out of sync

查看:19
本文介绍了iOS UIPageViewController 页面控件不同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我滑动页面控制器并同时在滑动的相反方向点击底部的UIPageControl时,当前正在显示的页面和pageControl中的页码将不同步.

Whenever I swipe the page controller and tap the UIPageControl at the bottom in the opposite direction of the swipe at the same time, the page that is currently being displayed and the page number in the pageControl will be out of sync.

有没有人遇到过这个奇怪的问题并解决了它?

Has anyone ever had this weird issue and solved it?

如果您需要任何其他信息,请告诉我.

Let me know if you need any additional info.

推荐答案

刚刚查看了 UIPageControl 的文档.我自己从未意识到这一点,但是您可以使用页面控件进行输入:

Just checked out the docs for UIPageControl. I never realized this myself, but you can use page controls for input:

当用户点击页面控件移动到下一页或上一页时,控件发送 UIControlEventValueChanged 事件以供处理代表.然后委托可以评估 currentPage 属性确定要显示的页面.页面控件只前进一个任一方向的页面.

When a user taps a page control to move to the next or previous page, the control sends the UIControlEventValueChanged event for handling by the delegate. The delegate can then evaluate the currentPage property to determine the page to display. The page control advances only one page in either direction.

我的建议是禁用页面控件或更新您的应用以响应其上的输入.在我的页面控件上将 userInteractionEnabled 设置为 false 为我解决了这个问题.

My suggestion would be to either disable the page control or update your app to respond to input on it. Setting userInteractionEnabled to false on my page control resolved the problem for me.

这篇关于iOS UIPageViewController 页面控件不同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆