【问题标题】:How do I replace UIPageControl dots with UILabel to display number of pages如何用 UILabel 替换 UIPageControl 点以显示页数
【发布时间】:2017-01-12 12:45:13
【问题描述】:

我想用 UILabel 替换 UIPageControl 的点,以用 swift 语言显示类似 page 1 of 30 的文本。

【问题讨论】:

  • 移除页面控制器并在此位置设置标签

标签: swift swift3 uilabel uipagecontrol


【解决方案1】:

将您的UIPageControl 替换为UILabel,然后替换为:

pageControl.currentPage = self.currentPage
pageControl.numberOfPages = self.totalPages

设置标签,然后使用简单的字符串插值:

label.text = "Page \(self.currentPage) of \(self.totalPages)"

【讨论】:

  • 如何把它放在 UIPageViewController 中?
猜你喜欢
  • 1970-01-01
  • 2014-08-09
  • 1970-01-01
  • 2020-07-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多