【问题标题】:How to change PageViewController dots position in Swift?如何在 Swift 中更改 PageViewController 点的位置?
【发布时间】:2015-08-06 11:42:04
【问题描述】:

你怎么能看到我的 imageView 没有覆盖全屏。我该怎么做才能让我的 imageView 覆盖全屏并且点在 imageView 上?

我用 viewController + PageViewController 做到了。

我调整它的大小:

self.pageViewController.view.frame = CGRectMake(0, 0, self.view.frame.width, self.view.frame.size.height)

我的代码很长,所以如果您想查看我的代码的确切部分 - 请询问

【问题讨论】:

  • 你的图片尺寸是多少?够大吗?
  • @Munahil 是的,当然
  • 将 UIImageView 设置为您想要的大小,并将其中的图像设置为“缩放填充”,而不是 Aspect Fit

标签: ios swift uipageviewcontroller


【解决方案1】:

如果您必须只显示数组中的图像,那么您可以使用 UIScrollView 来包含所有图像。

之后,您可以使用 UIPageControl。将 UIPageControl 添加到您的 UIView。

然后在ScrollViewDidEndDecelerating方法中,通过计算UIScrollView的contentOffset可以设置UIPageControl。

希望这会有所帮助。

【讨论】:

    【解决方案2】:

    您可以使用 pageVC 委托来了解页面何时更改并更新点。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-14
      • 1970-01-01
      • 1970-01-01
      • 2016-11-06
      • 1970-01-01
      相关资源
      最近更新 更多