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) 顶部添加按钮
基础教程推荐
- NSString intValue 不能用于检索电话号码 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
