使用界面生成器对齐全屏子视图时出现问题

发布于 2024-12-28 14:11:28 字数 333 浏览 4 评论 0原文

我正在开发一个具有 RootViewController 和 SubViewController 的简单应用程序。 RootViewController 仅在全屏 SubViewController 中加载,但 SubViewController 未正确对齐。

在此处输入图像描述

注意 UITableView 如何在屏幕顶部被切断。

我认为这一定与状态栏有关,因为状态栏似乎是被切断的确切尺寸。我已经尝试了界面生成器中“模拟指标”的所有逻辑组合,但我永远无法完全正确。

我做错了什么?

I'm working on a simple application that has a RootViewController and a SubViewController. The RootViewController just loads in the fullscreen SubViewController but SubViewController isn't aligned correctly.

enter image description here

Notice how the UITableView is being cut off at the top of the screen.

I figure this must have something to do with the status bar as that seems to be the exact size that's being cut off. I've tried every logical combination of "simulated metrics" in interface builder but I can never get it quite right.

What am I doing wrong?

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

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

发布评论

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

评论(1

不知所踪 2025-01-04 14:11:28

在你的 viewDidLoad 中尝试这样的事情,不确定你是如何加载的......

self.navigationController.navigationBar.frame = CGRectOffset(self.navigationController.navigationBar.frame, 0.0, -20.0);

Try something like this in your viewDidLoad, not sure how you are loading things up...

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