如何在tableView控制器上添加浮动按钮



我有一个tableView控制器。我想添加一个浮动按钮,就像YouTube应用程序中的按钮一样。当我拖动按钮时,它在tableView内,而不是浮动的

对于这种情况,你可以在UIViewController中使用UITableView,而不是UITableViewController。对于UITableViewController当你做某事时

[self.view addSubView:customButton];
//or
[self.tableView addSubView:customButton];

然后它认为你正在添加一个子视图到你的tableView作为tableViewController主视图是你的tableView。

简单地有一个UIViewController和添加UITableView作为子视图,并添加customButton到你的主视图作为子视图。

[self.view addSubView:myTableView];
[self.view addSubView:customButton];

或者你也可以在IB中创建:)

最新更新