僅僅因爲我無法找到一種安全的方式(從某種意義上說它可以被Apple人拒絕)來自定義UITabbar,特別是UITabBarItem,我正在嘗試一些解決方法。 我有一個主視圖,我重新創建了一種UITabBar,一個普通的視圖,裏面有兩個按鈕。這是(大致)目前階層:通過編程創建UINavigationController
-MainView
--placeholder(的UIView)
--fakeTab(的UIView)
我想要做的是,按一個按鈕就後在fakeTab中,構建一個UINavigationController並將其添加到「佔位符」視圖,以便fakeTab保持最前端,並且整個導航都發生在佔位符級別上。
我已經試着用這段代碼攔截點擊按鈕的方法,它的工作原理,我可以看到ipvc.view添加到佔位符。
IPPlantsViewController *ipvc = [[IPPlantsViewController alloc] initWithNibName:@"IPPlantsView" bundle:[NSBundle mainBundle]];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:ipvc];
UIView *placeholder = [self.view viewWithTag:200];
[placeholder addSubview:ipvc.view];
可是後來,當我從裏面IPVC打電話,然後什麼也沒有發生:
IPAttributes *ipas = [[IPFactory findPlantByIndex:indexPath.row] attrs];
[self.navigationController pushViewController:ipa animated:YES];
我希望我自己清楚:-)
感謝