简体   繁体   中英

UIButton above UITableView

I have a tableView in a UIViewController. My tableView is NOT an IBOutlet.

The UIViewController has a navigation bar due to being pushed from another view.

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.

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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