在 UITableView 之后、UITabBar 之前添加 UIView?

发布于 2024-08-23 10:25:14 字数 463 浏览 9 评论 0原文

我正在尝试添加一个 UIView,特别是 UIImageVIew,位于 UITableView 之后(即下方,但不是 z 索引意义上),但位于 UITabBar 之前(即上方)。

你知道,典型的“横幅/广告空间”随处可见。

顺便说一句,我的主要问题是我不知道到底把它放在哪里,具体作为哪个视图的子视图; UITableView 根据 UITabBarController 主视图高度减去标签栏高度后剩余的空间自动调整大小。 我希望将它放在 UITableView 内部而不是其他地方,因为它与 UITableView 的内容更相关,但我遇到了上述所有自动调整大小问题。我尝试过使用 autoresizingmask 和 autoresizesubviews 标志,但没有成功。我什至尝试过 UITableView 的页脚,但它的位置不固定,如果表格很长(预期的,正常的),它就会滚动。

有没有办法在这一点上添加子视图,正确拉伸表格本身?

谢谢大家。

I'm trying to add a UIView, in particular a UIImageVIew, after (that is, below, but not in a z-index sense) a UITableView but before (that is, above) a UITabBar.

You know, the typical "banner/adv space" that you can see everywhere.

My main problem btw is that i don't know exactly where to put it, as a subview of wich view specifically; the UITableView resize automatically according to the space left from the UITabBarController's main view height, minus the height of the tabbar.
I would like it to be put inside the UITableView instead of somewhere else beacuse it is more related to the content of the UITableView, but i have all the autoresizing problems of above. I've tried playing with autoresizingmask, and with the autoresizesubviews flag, but without success. I've even tried the footer ot the UITableView, but that is not fixed in position, it scrolls away if the table is long (expected, and normal).

Is there a way to add a subview in that point, stretching the table itself correctly?

Thanks everybody.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情感失落者 2024-08-30 10:25:14

使用普通的 UIViewController 而不是 UITableViewController。使用视图控制器的视图作为容器视图,在其中放置表视图和图像视图。您的视图控制器仍然可以充当表视图的委托和/或数据源。

Use a normal UIViewController instead of a UITableViewController. Use the view controller's view as a container view in which you place the table view and the image view. Your view controller can still act as your table view's delegate and/or datasource.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文