2014-01-06 67 views
0

我在使用-hidesBottomBarWhenPushed屬性時出現奇怪的視圖控制器問題。這是一個僅限iOS 7的項目。使用Xcode 5.什麼是最新的。沒有貝塔。-hidesBottomBarWhenPushed導致在導航控制器中使用時出現問題

有幾個問題,但我認爲他們都圍繞着同樣的問題。這是我不同的用例。

兩個用例都以相同的佈局開始。 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:

我們可以跳過一個視圖,並得到了類似的結果。

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 - 是否大部分繁重。由於其他問題的示例和修復,在將視圖推出之前設置-hidesBottomBarWhenPushed屬性。

所有視圖控制器在init,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]; 

此方法繼續將所有視圖壓入導航堆棧。基本上,在我推送之前,我將當前視圖的-hidesBottomBarWhenPushed屬性設置爲與我即將推送的視圖相同。在我推動之後,我把它恢復到了我推動之前的狀態。

我已經嘗試過設置這個的每一個組合,我最終都遇到了問題。我需要能夠控制何時顯示標籤欄。有些情況下它會一直在起作用。有些會顯示/隱藏/顯示/顯示,以及兩者之間的每個組合。唯一不變的是,它將始終顯示在導航堆棧的根/第一個視圖上。之後,這一切都取決於用戶採取的路徑。幫幫我!!!

回答

0

提交雷達後,似乎蘋果已經承認這是iOS 7中的一個錯誤。他們報告說它已在iOS 7.1b4中修復。我也已經證實,這個版本也是固定的。