UIButton 跨越 UIPageViewController 的所有页面 [英] UIButton across all pages of UIPageViewController

查看:69
本文介绍了UIButton 跨越 UIPageViewController 的所有页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 iPhone 应用程序,并创建了一个 UIPageViewController(我们称之为 容器),其中包含许多 UIViewController页面(我们称它们为子页面).子页面过渡样式是滚动.

I am working on an iPhone app, and created a UIPageViewController (lets call it the container), which contains a number of UIViewController pages (lets call them the subpages). The subpages transition style is scroll.

现在,我喜欢在容器的右上角创建一个按钮,而不是在子页面.这个想法是,当子页面从一个页面滚动到另一个页面时,按钮将停留在屏幕上.如果我在其中一个子页面中创建按钮,那么每个子页面都会有自己的按钮,并且该按钮将随子页面一起滚动.我想保持按钮不移动 容器,而 子页面 滚动.

Now, what I like to do is create a button on the top right corner of the container and NOT in the subpages. The idea is, the button will stay on screen when the subpages scroll from one page to the other. If I create the button in one of the subpages, then each subpage will have its own button, and the button will scroll with the subpages. I want to keep the button without moving in the container, while the subpages scroll.

我尝试将使用情节提要的按钮添加到容器,但现在允许进入.我无法将其放在那里,我怀疑原因是容器> 属于 UIPageViewController 类型.

I tried to add the button using the storyboard to the container, but it is now allowed in. I cannot drop it there, and I suspect the reason is because container is of type UIPageViewController.

我如何使用故事板来做到这一点?

How can I do that using the storyboard?

谢谢.

推荐答案

  1. 在您的故事板中,创建一个标准的 Viewcontroller 场景.
  2. 向这个场景添加固定按钮和容器视图.
  3. 添加容器视图将自动添加嵌入式视图控制器.选择并删除它.
  4. 将页面视图控制器拖到情节提要中.
  5. 选择容器视图并从其触发的segues"列表中的viewDidLoad"项拖动到页面视图控制器.选择嵌入"作为转场类型.

这篇关于UIButton 跨越 UIPageViewController 的所有页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆