gpt4 book ai didi

iphone - UIPageViewController 与 PageControl

转载 作者:IT王子 更新时间:2023-10-29 07:57:26 27 4
gpt4 key购买 nike

我正在使用 UIPageViewController 来显示其他 4 个 ViewController。所以我的 RootViewController 是一个 PageViewController ,它显示我在我的 Storyboard中创建的其他 4 个 ViewControllers 与不同的 Views 。一切都很完美。但是是否可以将 UIPageControl 添加到此 PageViewController 中。这有可能吗?

或者有人知道我怎样才能达到类似的结果?

太好了,谢谢!

最佳答案

您需要实现这些UIPageViewControllerDataSource 方法:

swift

func presentationCount(for pageViewController: UIPageViewController) -> Int { ... }
func presentationIndex(for pageViewController: UIPageViewController) -> Int { ... }

Obj-C

- (NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController
- (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController

然后您会在 UIPageViewController 的底部 36px 处看到一个页面控件。如果看不到它们,请尝试将 View 的颜色更改为深色。

关于iphone - UIPageViewController 与 PageControl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15677682/

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