ios - 在顶层 UITableViewController 上创建 UIButton,就像 AirBnB

标签 ios swift xcode button

如何在 UITableViewController 中创建 UIButton,就像 AirBnB map 一样。

在屏幕截图中以红色突出显示。

enter image description here

最佳答案

实际上很简单,只需像往常一样创建 TableView ( Storyboard或代码),然后创建按钮,正确定位它,设置约束并确保它不是 TableView 的 subview 但包含 TableView 的 View 。

由于您没有指定是否使用 Storyboard ,我确实在下面的示例中使用了它。

看看我刚刚创建的这个极其简单的演示: enter image description here

这是 View 层次结构:

enter image description here

这些是按钮的约束:

enter image description here

关于ios - 在顶层 UITableViewController 上创建 UIButton,就像 AirBnB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59316497/

相关文章:

ios - 从其他 View Controller 为 uiimageview 设置 uiimage

swift - 如何实现图书馆进化?

xcode - 为什么我不能导入 ClockKit 并在 Xcode Playground 中使用 CLKComplicationDataSource?

swift - 框架项目 仅构 build 备不能用于运行此目标

swift - 想要像实时数据库一样获取 firestore

ios - 当我在模拟器上运行此代码时,它运行得很好,但是在真实设备上却崩溃了?

ios - 定义 SCNNode 的位置

xcode - 为什么 SKNode 在 SpriteKit 游戏中对触摸没有反应?

ios - 如何仅为某些 View Controller 自定义 UINavigationBar

ios - iPhone 消息过滤器扩展无法正常工作