简体   繁体   English

UITableView上方的UIButton

[英]UIButton above UITableView

I have a tableView in a UIViewController. 我在UIViewController中有一个tableView。 My tableView is NOT an IBOutlet. 我的tableView不是IBOutlet。

The UIViewController has a navigation bar due to being pushed from another view. 由于被从另一个视图推入,UIViewController具有导航栏。

I want to add a UIButton above the tableview, but buttons/views do not appear above the tableview even if I add them in storyboard or use the "bringSubviewToFront" method. 我想在表格视图上方添加UIButton,但是即使将按钮/视图添加到情节提要中或使用“ bringSubviewToFront”方法,按钮/视图也不会出现在表格视图上方。

I noticed that buttons/vews do appear behind the navigation bar when translucent, but that of course is not where I want them. 我注意到按钮/窗口在透明时确实会出现在导航栏的后面,但是那当然不是我想要的。

None of these codes have worked: 这些代码均无效:

[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];

Thanks in advance. 提前致谢。

您将需要设置edgesForExtendedLayout以便不包括顶部

self.edgesForExtendedLayout = UIRectEdgeLeft | UIRectEdgeBottom | UIRectEdgeRight;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM