UITabBarController 中的 UITableView 在旋转时向下移动 10 px

发布于 2024-10-18 11:54:53 字数 391 浏览 4 评论 0原文

我在 UITabBarController 中有一个 UITableView,当 TableView 的起始方向是横向时没有问题,但是当起始方向是纵向时它会在旋转后向下移动 10 px,请参阅

旋转之前的图像:

旋转后:

灰色 10 像素矩形显示在 Status 和 UINavigationController 之间。

任何帮助将不胜感激。 谢谢大家。

I have a UITableView inside UITabBarController, when the starting orientation for the TableView is Landscape there is no problem, but when the Starting Orientation is Portrait it get shifted down by 10 px after rotating, please see Images,

Before Rotating:

After Rotating:

The gray 10 pixel rect is shown between the Status and the UINavigationController.

Any help would be so much appreciated.
Thanks all.

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

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

发布评论

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

评论(2

烟雨扶苏 2024-10-25 11:54:53

在界面生成器中打开 XIB,单击表格视图,打开检查器,选择“视图大小”选项卡(左起第三个)。在“自动调整大小”(不是大小和位置)下,您将看到一个白色矩形,内部有一个黑色矩形,以及一堆箭头和线条,这些箭头和线条将影响视图对超级视图大小调整的反应(如果我错了,请纠正我)。基本上,尝试一下:)我可能是错的,但我认为在你的情况下,你应该选择两个自动调整大小箭头(小黑色矩形内的2)和顶部和左侧的线(在黑色矩形)。

Open the XIB in interface builder, click on the tableview, open the inspector, choose the View Size tab (third from the left). Under Autoresizing (not size and position) you will see a white rectangle, with a black rectangle inside, and bunch of arrows and lines that will effect that way the view reacts to resizing of the superview (correct me if i'm wrong). Basically, play around with those :) I might be wrong but i think that in your case, you should select both autoresizing arrows (the 2 inside the small black rectangle) and the lines to the top and to the left of it (outside of the black rectangle).

世界和平 2024-10-25 11:54:53

我已经找到了解决方案,但它似乎与我所面临的问题无关,但我尝试了一切,这终于完成了工作。

这是我以前所做的:

之前

我通过从 XIB 连接的 IBOutlet 加载我的 UITabController 并按如下方式加载:

[window addSubview:self.oTabNavigationViewController.view];

现在

我从 XIB 中删除了我的 UITabViewController 并从应用程序委托中加载它,如下所示:

self.oTabNavigationViewController = [[TabNavigationViewController alloc] initWithNibName:@"TabNavigationViewController_ipad" bundle:nil];

[self.oTabNavigationViewController.view setFrame:[[UIScreen mainScreen ]applicationFrame]];
[window addSubview:self.oTabNavigationViewController.view];

感谢大家努力。

I have found the solution, but it seems has nothing to do with what i was facing but i tried everything and this finally did the job.

Here what i used to do to:

Before

I used to load My UITabController through an IBOutlet connected from on XIB and load it as follow:

[window addSubview:self.oTabNavigationViewController.view];

Now

I Removed my UITabViewController from the XIB and load it from the application delegate as follows:

self.oTabNavigationViewController = [[TabNavigationViewController alloc] initWithNibName:@"TabNavigationViewController_ipad" bundle:nil];

[self.oTabNavigationViewController.view setFrame:[[UIScreen mainScreen ]applicationFrame]];
[window addSubview:self.oTabNavigationViewController.view];

Thanks all for the effort.

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