Swift 如何在 PageControl 中显示所有点
Hello, in this app i have 3 pages (index 0 - 2). But how the PageControl just show 2 pages? How can I show all dots of pages in my page control?
thank you :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它从gif中看起来好像所有三页都存在于您的uipagecontrol中,但是实际上只显示了前两个相应的点。
要修复它,只需添加以下内容:
pagecontrol.sizetofit()
在视图控制器的
viewDidload
内。这将导致页面控件扩展以显示与存在页面一样多的点。
It appears from the GIF as if all three pages are present in your UIPageControl, but only the first two corresponding dots are actually being displayed.
To fix it, just add this:
pageControl.sizeToFit()
inside your view controller's
viewDidLoad
.This will cause the page control to expand to display as many dots as pages exist.