隐藏标签栏显示空白(即使框架是全屏)

发布于 2024-11-18 11:01:42 字数 799 浏览 5 评论 0原文

尝试在选项卡控制器中进行全屏视图。这是风景。能够使用 self.tabBarController.tabBar.hidden = YES 隐藏选项卡栏,这会在选项卡栏所在的位置留下空白。

使 tabbarcontroller 的视图全屏显示:

self.tabBarController.view.frame = self.view.frame = CGRectMake(0, 0, 480, 320);
[self.tabBarController.view setCenter:CGPointMake(160.0f, 240.0f)];
self.tabBarController.tabBar.hidden = YES;
self.tabBarController.view.backgroundColor = [UIColor redColor];

然后我尝试使 viewcontrollers 也全屏显示。但它不会粘住,无法调整 view.frame 的大小。

self.view.backgroundColor = [UIColor yellowColor];
self.view.frame = CGRectMake(0, 0, 480, 320);
[self.view setCenter:CGPointMake(160.0f, 240.0f)];

有没有办法以一种很好的方式解决这个问题?

标签栏消失时的空白图像(红色)

Trying to make fullscreen view in a tabbarcontroller. It's in landscape. Are able to hide the tabbar with self.tabBarController.tabBar.hidden = YES this leaves a whitespace where the tabbar have been.

Making the tabbarcontroller's view fullscreen with:

self.tabBarController.view.frame = self.view.frame = CGRectMake(0, 0, 480, 320);
[self.tabBarController.view setCenter:CGPointMake(160.0f, 240.0f)];
self.tabBarController.tabBar.hidden = YES;
self.tabBarController.view.backgroundColor = [UIColor redColor];

Then I try to make the viewcontrollers view fullscreen also. But it will not stick, unable to resize view.frame.

self.view.backgroundColor = [UIColor yellowColor];
self.view.frame = CGRectMake(0, 0, 480, 320);
[self.view setCenter:CGPointMake(160.0f, 240.0f)];

Is there anyway to get around this in a nice fashion?!

Image of whitespace (in red) were tabbar is gone

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

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

发布评论

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

评论(2

丘比特射中我 2024-11-25 11:01:42

在推送 viewController 之前,将 hidesBottomBarWhenPushed 属性设置为 YES。

Set hidesBottomBarWhenPushed property to YES before pushing your viewController.

但可醉心 2024-11-25 11:01:42

您是否尝试使用视图控制器的 autoresizingMask 属性,而不是尝试手动调整视图框架的大小?

self.tabBarController.view.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
self.view.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);

Did you try to play with autoresizingMask property of your view controllers instead of trying to resize manually the view frames ?

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