gpt4 book ai didi

ios - -hidesBottomBarWhenPushed 在导航 Controller 中使用时会导致问题

转载 作者:行者123 更新时间:2023-12-01 22:47:15 25 4
gpt4 key购买 nike

我在使用 -hidesBottomBarWhenPushed 时遇到了奇怪的 View Controller 问题属性(property)。这是一个仅限 iOS 7 的项目。使用 Xcode 5.whatever 是最新的。没有贝塔。

有几个问题,但我认为它们都围绕同一个问题。这是我的不同用例。

两个用例都以相同的布局开始。 UITabBarController(2 个选项卡)-> UINavigationController(Tab1)-> Tab2(例如不需要)-> 在我的应用程序窗口中设置为 rootViewController。

用例 1:

ViewController1 - Has navigation controller and tableview with content. Push a view controller that does not need the tab bar (uses toolbar with custom content).
ViewController2 - Tab bar is not showing, things look great so far. Now I need to push another view controller that needs the tab bar again.
ViewController3 - Tab bar is showing, things are still good to go. One more level to go, tab bar still needs to show.
ViewController4 - Tab bar is missing. Not good. This sucks, lets back up.
ViewController3 - Tab bar is now gone here too. View takes up full space, that is good, but no tab bar. Back we go.
ViewController2 - What the eff? My toolbar is shaded and can't be selected, and the view is sized like there is a tab bar there. I can scroll content and see where it thinks the view ends. This view is toast, back to home.
ViewController1 - Everything is back to normal. Tab bar showing no problem. I can drill back in with no issues going in, but coming back, everything is hosed pretty bad.

用例 2:

我们可以跳过一个 View 并获得类似的结果。
ViewController1 - Same as Use Case 1. Our home view, where everything is working and looks great.
ViewController3 - Lets skip the toolbar view and keep our tab bar in place. No sweat. Tab bar shows up fine. Looks good, lets drill in one more level.
ViewController4 - The hell? Tab bar is here, but it looks shaded or selected. Content is offset up from the tab bar, it doesn't line up with the tab bar. About the same height as the tab bar. If we toggle tabs, the tab bar loses its shaded state. Come back to same screwed up view... looks fine now. The table view here is now nested perfectly on top of the tab bar. I give up!!
ViewController3 - The tab bar here looks fine at least. Whew! One less thing to fix.
ViewController1 - Home still looks good. Please don't ever leave me home view.

这些是我采取的步骤。现在谈谈我是如何插入这些观点的。

ViewController1 - 完成大部分繁重的工作。由于其他问题的示例和修复,在将 View 推出门之前设置 -hidesBottomBarWhenPushed 属性。

所有 View Controller 在初始化期间都有一个属性设置,self.hidesTabBar; YES 隐藏它,NO 显示它。
ViewController2 alloc/init; // normal init stuffs
// set current view property to the property on next views property (set in init of view)
[self setHidesBottomBarWhenPushed:ViewController2.hidesTabBar];
[self.navigationController pushViewController:ViewController2 animated:YES];
// set back after pushing to what the current view needs to be at
[self setHidesBottomBarWhenPushed:self.hidesTabBar];

对于被推送到导航堆栈的所有 View ,此方法将继续。基本上,在我推送之前,我将当前 View -hidesBottomBarWhenPushed 属性设置为与我将要推送的 View 相同。推后,我将其设置回推前的状态。

我已经尝试了设置这个的每一种组合,但我最终遇到了问题。我需要能够控制何时显示标签栏。在某些情况下,它将永远存在。有些会显示/隐藏/显示/显示,以及两者之间的每种组合。唯一不变的是它将始终显示在导航堆栈的根/第一个 View 上。之后,这一切都取决于用户采用的路径。帮助!!!

最佳答案

在提交雷达后,Apple 似乎已经承认这是 iOS 7 中的一个错误。他们报告说它已在 iOS 7.1b4 中修复。我还确认这在该版本中也已修复。

关于ios - -hidesBottomBarWhenPushed 在导航 Controller 中使用时会导致问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20955380/

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