Add button on top of UITableViewController (Swift)(在 UITableViewController (Swift) 顶部添加按钮)
问题描述
我正在尝试在 uitableview 控制器表视图的顶部添加一个按钮.视图控制器有一个导航控制器和静态单元格,这就是为什么它是一个 uitableviewcontroller 而不是一个 uiviewcontroller.现在我正在尝试在屏幕底部添加一个按钮,该按钮连接到导航控制器,这样它就不会随着表格视图滚动.
我正在尝试制作类似于下面的内容.它有一个用于顶部栏的导航控制器、一个带有静态单元格的表格视图和一个按钮,但是它们是如何实现按钮的呢?
图片:
这样您就可以使用静态单元格原型,而不仅限于同时使用 UITableView.
结果:
I am trying to add a button ontop of a uitableview controller table view. The view controller has a navigation controller and static cells, which is why it is a uitableviewcontroller and not a uiviewcontroller. Now I am trying to add a button at the bottom of the screen that is attached to the navigation controller so that it doesn't scroll with the table view.
I am trying to make something similar to what is below. It has a navigation controller for the top bar, a table view with static cells and then a button, but how did they do the button?
Image: http://postimg.org/image/ilsmqqrip/
Thanks!
UPDATE: How can I use a uiviewcontroller with a tableview with static cells using Swift?
I find Container Views very useful in this scenario! A clean solution and very easy to implement.
Just create a normal UIViewController, add your button and a ContainerView as subviews of this UIViewController (the middle one in the image below). Finally create Embed Segue from ContainerView to your UITableViewController (the one on the right).
This way you can use static cell prototypes, not being limited only to UITableView at the same time.
Result:
这篇关于在 UITableViewController (Swift) 顶部添加按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 UITableViewController (Swift) 顶部添加按钮


基础教程推荐
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01