How to show and hide tab bar at required places?
Hi i am making an application where ther are four screens(view controllers) from 1 to 4. I want to show screen 1 without tab bar .This screen will have three buttons through which user can navigate to other screens. Now when user taps screen 2 button then user should navigate to screen 2 with tab bar on bottom.Now this tab bar开发者_StackOverflow will have four tabs from screen 1 to 4 to navigate .Similarly when now user tap on tab 1 then the scrren 1 should arrive which is without tab bar and so on. My problem is i am not able to load or unload tab bar at required places.I have tried following:
- I opened screen 1 on statrt up and on screen 1's view did load added the tab bar but it didnt work
I added tab bar on main window but then tab bar starts to show even on screen 1.
PLease tell me the correct way to do this (In other words a tab bar with four tabs in which the first screen should not show tab bar)
Thanks in advance
use this single line
self.hidesBottomBarWhenPushed=YES;
for hide tab bar. use this before push the page where you want tab Bar hidden and also write this line
self.hidesBottomBarWhenPushed=No;
at same page from where you are going to push in viewWillDisappear
.
self.window.rootViewController = self.navigationController;
First add your rootviewcontroller in the window. and add three buttons in it.
on clicking event of button add tabbarcontroller to mainwindow
AppDelegate *delegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
delegate.tCtr.selectedIndex = btntag; //ur button tag;
delegate.tCtr.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:delegate.tCtr animated:YES];
精彩评论