OGeek|极客世界-中国程序员成长平台

标题: ios - UIView 在 UITableViewController 上 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 21:38
标题: ios - UIView 在 UITableViewController 上

我需要在 UITableViewController 上放置一个 UIView,现在我是这样放置的

[self.navigationController.view addSubview:searchView];

但问题是 - 当我将这个 UITableViewController 推到另一个时 - 我的 UIView 没有被 UITableViewController 推开,但仍然挂断在那里,我当然可以用动画来删除它,但它看起来很糟糕

有没有办法让我的 UIView 与 UITableViewController 一起覆盖另一个 VC?

谢谢!



Best Answer-推荐答案


你不能使用 [self.view addSubview:searchView] 因为在这种情况下 self.view 只是 UITableview 所以这将在 tableview 和你的view 也会随着 tableview 滚动。 你可以使用

[self.navigationController.view addSubview:searchView];

关于ios - UIView 在 UITableViewController 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23102463/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4