不仅在滚动视图结束减速时,如何更改uipagecontrol点?
我已经创建了一个用户入职,用2个项目创建了收集视图
。
集合视图
具有uipagecontrol
,该显示了当前有效的页面用户。
问题是,在用户刷新到下一个\上一个屏幕之后,我才能更改活动UIPAGECONTROL的状态
DOT。
这就是现在的样子: gif
我想要这种行为,所以当您开始刷卡uipagecontrol 应该已经将其活动点更改为下一个\上一个,而我一定要结束滑动(抬起手指)。
您可以在GIF上检查我想要的内容: gif
这就是我更改uipagecontrol 点现在:
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
let width = scrollView.frame.width
currentPage = Int(scrollView.contentOffset.x / width)
pageControl.currentPage = currentPage
}
应该如何修改我的代码,用于实现行为的方法?我在Stackoverflow上找不到任何类似的问题。
I have created a User Onboarding as a Collection View
with 2 items.
The Collection View
has a UIPageControl
which shows an active page user currently on.
The problem is I can change the state of active UIPageControl
dot only when the transition is ended, after user swiped to the next\previous screen.
This is how it looks now: GIF
I want the behaviour so when you start to swipe UIPageControl
should already change its active dot onto the next\previous one without me necessarily ending the swipe (lift the finger).
You can check what I want on the gif: GIF
Here is how I change the UIPageControl
dot now:
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
let width = scrollView.frame.width
currentPage = Int(scrollView.contentOffset.x / width)
pageControl.currentPage = currentPage
}
How my code should be modified, which method to use to achieve the behaviour? I couldn't find any similar questions on StackOverflow.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基于您的问题...
而不是
scrollviewdidendendendDecelerating
,实现:Based on your question...
Instead of
scrollViewDidEndDecelerating
, implement: