空白代替隐藏的标签栏

发布于 2025-01-01 22:40:41 字数 189 浏览 2 评论 0原文

我在 UITabBarController 中使用 UINavigationController,导航控制器中的屏幕之一是 UIImageView。当我想全屏显示该图像时,我必须隐藏导航栏和标签栏。我能够正确隐藏导航栏,但是当我隐藏选项卡栏时,它会留下 50px 的空白。有什么建议吗?

I use UINavigationController inside UITabBarController and one of the screens in my navigationcontroller is a UIImageView. When I want to show that image full screen I have to hide the navigation bar and tab bar. I'm able to hide the navigation bar correctly but when I hide the tab bar, it leaves 50px of white space. Any suggestion?

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

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

发布评论

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

评论(6

猫卆 2025-01-08 22:40:42

我认为你可以在模型视图控制器上显示它。
将 modelviewcontroller 放在 tabbarcontroller 上。

FullImageView*objFullImageView = [[FullImageView alloc] initWithNibName:@"FullImageView" bundle:nil];
objFullImageView.image = OriginalImage;
UINavigationController *tempNav = [[[UINavigationController alloc] initWithRootViewController:objFullImageView] autorelease];
[objFullImageView release];
self.tabBarCtrl.modalPresentationStyle = UIModalPresentationPageSheet;
[self.tabBarCtrl presentModalViewController:tempNav animated:YES];

FullImageView.h

{  
    UIImage *image;
}
@property(nonatomic, retain) UIImage *image;

FullImageView.m

@synthesize image;

viewDidLoad /ViewWillApper
{
    //Set image in your UIImageView    
}

I think you can show it on model view controller.
Put modelviewcontroller over tabbarcontroller.

FullImageView*objFullImageView = [[FullImageView alloc] initWithNibName:@"FullImageView" bundle:nil];
objFullImageView.image = OriginalImage;
UINavigationController *tempNav = [[[UINavigationController alloc] initWithRootViewController:objFullImageView] autorelease];
[objFullImageView release];
self.tabBarCtrl.modalPresentationStyle = UIModalPresentationPageSheet;
[self.tabBarCtrl presentModalViewController:tempNav animated:YES];

FullImageView.h

{  
    UIImage *image;
}
@property(nonatomic, retain) UIImage *image;

FullImageView.m

@synthesize image;

viewDidLoad /ViewWillApper
{
    //Set image in your UIImageView    
}
み格子的夏天 2025-01-08 22:40:42

我通过改变约束解决了这个问题。

我的选项卡栏 viewController 中有一个视图,其底部约束是从 Safe Area.bootom 给出的 (=0)。这导致底部出现空白。从 Superview.bottom 将此约束更改为 (=0) 解决了我的问题。

I solved this problem by changing constraints.

I had a view in my tabbar viewController whose bottom constraint was given (=0) from Safe Area.bootom. This was causing white space at the bottom. Changing this constraint to (=0) from Superview.bottom solved my proble.

云之铃。 2025-01-08 22:40:42

您可以增加图像视图框架的高度。

You can increase the height of your image view frame.

遇见了你 2025-01-08 22:40:42

经过几个小时的研究,该线程解决了隐藏选项卡栏时的空白问题: 将 iPhone 设备旋转至横向时隐藏 TabBar

After hours of research, this thread resolved my blank space issue when hidding the tabbar: hiding TabBar when rotating iPhone device to landscape

很酷又爱笑 2025-01-08 22:40:42

距离最初的帖子已经过去了很长一段时间,但我想我可以加入并添加我的想法。

另一种选择是直接在情节提要中为所有在选项卡栏控制器内的导航控制器中推送的控制器设置选项推送时隐藏底部栏。这也适用于 iOS7 模拟器/目标,无论是 3.5 英寸还是 4 英寸。

It's been quite a long time since the original post, but I thought I could jump in and add my thoughts.

Another option would be to set the option Hide bottom bar on push directly within the Storyboard for all those controllers which are pushed within a navigation controller inside a tabbar controller. This works within iOS7 simulator/targets as well, both at 3.5" and 4".

你对谁都笑 2025-01-08 22:40:41

谢谢大家
我已经找到了解决我的问题的最佳方案。

MyImageViewController.hidesBottomBarWhenPushed = YES ;
[self.navigationController pushViewController:MyImageViewController animated:YES];

它给了我想要的回应。
谢谢你的分享

Thank you for all
I have found the best solution to my problem .

MyImageViewController.hidesBottomBarWhenPushed = YES ;
[self.navigationController pushViewController:MyImageViewController animated:YES];

It gave me the response I wanted .
Thank you for your share

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