UIPageControl 点击“滑动”?
当点击 UIPageControl 的侧面时,我使用什么方法使 UIScrollView 更新?滑动 UIScrollView 时,UIPageControl 会正确更新,但如果我点击 UIPageControl 的侧面转到下一页,则只有点会更新,但 UIScrollView 不会滑动。我查看了文档,但找不到任何方法?
如果您不确定我的意思,请转到 iPhone 主屏幕,然后点击 Dock 和分页图标之间的白点两侧。
What method to I use to make my UIScrollView update when the sides of a UIPageControl are tapped? When swiping the UIScrollView, the UIPageControl is updated correctly, but if I tap the sides of the UIPageControl to go to the next page, only the dots update, but the UIScrollView won't swipe. I've looked in the docs and am unable to find any methods for this?
If you're unsure of what I mean, go to your iPhone home screen and tap either side of the white dots, right between the dock and the paged icons.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只需确保为页面控件提供足够的宽度,并且已连接其 Value Changed 出口即可。如果你这样做,当它的值改变时你应该收到消息;查看控件上的 currentPage 属性。它可以正确处理左边距和右边距的点击。
Just make sure you're giving your page control enough width, and you've hooked up its Value Changed outlet. If you do this, you should get messages when its value changes; look at the currentPage property on the control. It handles left- and right-margin taps properly.
您正在寻找的方法是:
如果您在 UIPageControl valueChanged 上执行此操作,它应该是自动的。
The method you're looking for is:
If you do this on the UIPageControl valueChanged, it should be automatic.
请参阅我的答案:UIPageControl 本身无用吗?
可重用封装 UIPageControl 和 UIScrollView 的类。
See my answer here: Is UIPageControl Useless By Itself?
for a reusable class encapsulating the UIPageControl and UIScrollView.