1

I am using a navigation controller with n numbers of controllers.

Now while moving from one screen to another the top bar and bottom bar too transits if I push the controller.

So the question Is there any way out where I can prevent the transition of Top and bottom bar.

N.B. The contents of top bar are static but the contents of bottom bar keeps on changing depending upon the requirement in that particular page.

Any help or suggestions will really be appreciated.

Suresh Varma
  • 9,750
  • 1
  • 60
  • 91

2 Answers2

1

Make the tab bar not part of your navigationcontroller view.

Make a UIViewController with a view.
Make a instance variable in the UIViewController that is of the type UINavigationController.
Make the navigation bar hidden for the UINavigationController.

Set UIVIewController content like this

UIViewController     UIViewControllers content view setup.
-------------------  -------------------
|UIView           |  |UINavigationBar  |
|                 |  |-----------------|
|                 |  |UINavigationVi   |
|                 |  |ewController     |
|                 |  |content view     |
|                 |  |                 |
|                 |  |                 |
|                 |  |                 |
|                 |  |                 |
|                 |  |                 |
|                 |  |                 |
|                 |  |-----------------|
|                 |  |UIToolBar        |
-------------------  -------------------

Let the interaction from the bars call a method in the UIViewController, which interacts on his turn with the UINavigatioViewController.

I hope this was helpful and clear enough.

Note your current situation is like this:

UINavigationControllerViewController
-------------------
|view containing  |
|bars and current |
|controller       |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
-------------------
Mats Stijlaart
  • 5,058
  • 7
  • 42
  • 58
  • It works fine. but the only issue is since now my original controller will remain at its place and internal controller gonna navigate so all the view delegate methods like viewWillappear,didAppear,willDisappear wont gonna fire.. Now I need to fire them forcefully. Also in the second image if instead of UIViewController we take UINavigation controller then we dont need to set the **Y frame** of all the innerViews to start from 46 instead of 0 – Suresh Varma Jan 02 '12 at 10:01
  • I have created a sample application for this solution. See the code at: https://github.com/stil4m/NavControllerNoBars. In this solution you do not have to add the 46-pixel margin and you have the delegate methods. In the main view controller you can handle delegate calls from the UINavigationController. Please read the code in the repository. Hope this clears things up. – Mats Stijlaart Jan 02 '12 at 11:20
  • Thanks a ton Mats.. but the main thing was getting the viewWillAppear ,DidAppear,Disappear methods getting called.. which doesnt gets called automatically if we go this way.. even the sample you provided does not make a call to viewwillAppear and remaining views delegate methods :( – Suresh Varma Jan 02 '12 at 13:34
  • I understand, but your problem could be resolved by the following answer: http://stackoverflow.com/questions/895713/viewdidload-gets-called-viewwillappear-does-not-get-called-view-does-not-appea – Mats Stijlaart Jan 02 '12 at 13:54
0

Given your requirements stated above, I would use the UINavigationController but make the NavigationBar hidden and implement my own header bar graphic (UIView) and any required buttons.

[self navigationController].navigationBar.hidden = YES;
ader
  • 5,403
  • 1
  • 21
  • 26
  • But how would it prevent the top bar from animating? Only the top and bottom bar must not animate. rest the whole view need to be animated. – Suresh Varma Dec 20 '11 at 14:28