Add button on top of UITableViewController (Swift)

前端 未结 8 2006
盖世英雄少女心
盖世英雄少女心 2021-02-07 16:02

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:20

    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:

提交回复
热议问题