Swift 如何在 PageControl 中显示所有点

发布于 2025-01-19 06:21:28 字数 235 浏览 3 评论 0原文

我有3 个页面,但点仅浏览了 2

您好,在这个应用程序中我有 3 个页面(索引 0 - 2)。但是PageControl怎么只显示2页呢?如何在页面控件中显示页面的所有点?

谢谢 :)

I have 3 pages, but the dots viewed just 2

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

智商已欠费 2025-01-26 06:21:28

它从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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文