Add button on top of UITableViewController (Swift)

前端 未结 8 1072
夕颜
夕颜 2021-02-07 15:34

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 uitableviewcontr

8条回答
  •  不知归路
    2021-02-07 16:22

    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:

提交回复
热议问题