UIButton在UITableView之上

时间:2014-08-17 19:18:08

标签: ios uitableview uinavigationcontroller addsubview

我在UIViewController中有一个tableView。我的tableView不是IBOutlet。

UIViewController由于被另一个视图推送而有一个导航栏。

我想在tableview上面添加一个UIButton,但是即使我在storyboard中添加它们或使用“bringSubviewToFront”方法,按钮/视图也不会出现在tableview上方。

我注意到半透明时按钮/ vews确实出现在导航栏后面,但那当然不是我想要的。

这些代码都没有奏效:

[self.view addSubview:btnSend];// add Send btn
[self.view bringSubviewToFront:btnSend];// bring Send btn to Front
[self.navigationController.view addSubview:btnSend];
[self.navigationController.view bringSubviewToFront:btnSend];

提前致谢。

1 个答案:

答案 0 :(得分:0)

您需要设置edgesForExtendedLayout,以便不包含顶部

self.edgesForExtendedLayout = UIRectEdgeLeft | UIRectEdgeBottom | UIRectEdgeRight;