gpt4 book ai didi

ios - 从页面 View Controller 指示器中删除白色背景

转载 作者:行者123 更新时间:2023-11-29 01:13:32 25 4
gpt4 key购买 nike

是否可以从 UIPageViewController 指示器中移除白色背景?这是我在下面使用的代码。下面的代码片段来自 AppDelegate 脚本。

let pageControl = UIPageControl.appearance()
pageControl.pageIndicatorTintColor = UIColor.lightGrayColor()
pageControl.currentPageIndicatorTintColor = UIColor.blackColor()
//pageControl.backgroundColor = UIColor.whiteColor()

如您所见,我已经注释掉了 pageControler.backgroundColor = ... 行以查看它是否会改变但没有。我在 Xcode 中使用 Swift。这是向您展示我的意思的屏幕截图:

更新:我看过这个类似的问题(UIPageControl - How to make the background transparent?),但这并没有解决问题。我在 AppDelegate 中使用了以下代码,但没有成功。这是使用的代码:

pageControl.backgroundColor = UIColor.clearColor()

更新 2:这是 viewDidLoad() 中使用的代码。

    self.pageViewController.setViewControllers(viewControllers as? [UIViewController], direction: .Forward, animated: true, completion: nil)

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

self.addChildViewController(self.pageViewController)
self.view.addSubview(self.pageViewController.view)
self.pageViewController.didMoveToParentViewController(self)

最佳答案

让我们关注 View 顶部的白色。你是说:

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

因此,使用数字 30 时,您自己会在顶部留下间隙:self.pageViewController.view.frame 顶部向下 30 像素开始self.view.因此我们看到 self.view 的颜色显示在间隙中。如果您不喜欢那种颜色,请通过更改 self.view.backgroundColor 来更改它。

关于ios - 从页面 View Controller 指示器中删除白色背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35495017/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com