gpt4 book ai didi

iphone - iOS 7 TabBar 半透明问题

转载 作者:太空狗 更新时间:2023-10-30 03:14:30 25 4
gpt4 key购买 nike

我有一个问题,当我在 TabBar 上关闭半透明框时,有东西挡住了我的部分视线。

它看起来像是一种额外的标签栏,或者我什至不知道。我正在使用 Storyboard。

请看附件图片:

半透明(关闭 - 否):

With Translucent (OFF - NO)

半透明(ON 或 YES):

With Translucent (ON or YES)

有人知道为什么会这样吗?

谢谢

PS:你们喜欢哪个tabBar?黑色还是这个:

enter image description here

最佳答案

当您将 tabBar.translucent 设置为 NO 时,这会在 iOS7 中发生。 iOS 试图变得聪明,并说“嘿,标签栏不是半透明的,所以我们最好将所有内容都推到它上面”。通过将标签栏 Controller 内的导航 Controller 内的 View Controller 的 extendedLayoutIncludesOpaqueBars 属性设置为 YES 来修复它。

示例(未实际运行):

UITabBarController *tabBarController = [[UITabBarController alloc] init];
tabBarController.tabBar.barStyle = UIBarStyleBlack;
tabBarController.tabBar.translucent = NO;

UIViewController *viewController = [[UIViewController alloc] init];
viewController.extendedLayoutIncludesOpaqueBars = YES; // <-- This is important!!!!!!

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController: viewController];

tabBarController.viewControllers = @[navigationController];

来源:https://web.archive.org/web/20160405135605/https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/AppearanceCustomization.html

顺便说一句,我最喜欢非半透明的标签栏。

编辑

正如安迪在下面提到的,这个标志不必在代码中设置。如果那是您使用的,您可以在 IB 中设置它。

关于iphone - iOS 7 TabBar 半透明问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20979281/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com