gpt4 book ai didi

ios - 添加 UIPageView 作为屏幕的一部分

转载 作者:可可西里 更新时间:2023-11-01 06:21:09 25 4
gpt4 key购买 nike

对 iOS 开发还很陌生,很好奇是否有可能,如果可能的话,最好的人愿意去做。

我想让 UIPageViewController 成为屏幕的一部分。即,我想要一个菜单​​栏,也许还有一些额外的控件,然后将页面 View Controller 放在该页面的一部分上(因此菜单栏不是翻页控件的一部分)。换句话说,一个 UIPageView 就像一个不占据整个屏幕的 ScrollView 。

可接受的设计?

谢谢。

最佳答案

是的,这是可能的,而且实现起来也很容易。

步骤(使用 Storyboard在 XCode 6 中实现)

  1. 从一个空的 View Controller 开始。

empty view controller

  1. 从右边的对象库中添加一个容器 View 。容器 View 可能会自动嵌入到常规 View Controller 中,在这种情况下,您只需删除 View Controller 即可,因为我们要嵌入页面 View Controller 。

view controller with container view

  1. 从右侧的对象库中选择一个页面 View Controller ,并将其放置在 Storyboard中您想要的任何位置。

view controller and page view controller

  1. Ctrl 单击并从容器 View 拖动到页面 View Controller ,然后从出现的菜单中选择嵌入。页面 View Controller 应自动调整自身大小,使其与原始 View Controller 中的容器 View 大小相同。

page view controller embed step

关于ios - 添加 UIPageView 作为屏幕的一部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10202997/

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