views:

154

answers:

1

I am facing few problems while using tabBar with navigation controllers.Each tabBar item is associated with a separate navigation controller.Problems are listed as follows:

1.There are more than five tabBar items in my tabBar so a more tabBar item comes by default.Now when i tap the more tabBar item the remaining items come in a tableview which is actually the view of a navigation controller(which comes by default).Now when i select any of the row, my new view controller gets pushed into that navigation controller.I want my view controller to be the navigation controller.So there is a situation like pushing a navigation controller onto the sack of another navigation controller.The compiler gets confused and it does nothing.

2.Although I have set autoresizing of each controller of tab bar controller nothing happens on rotating the device.However when I keep only five or less tabBar items,autoresizing works perfectly.

3.I want an ImagView at the top throughout the application, so I attached an imageview on the window itself and than increases the y-coordinate of the tabBar controller's view so that the navigation bar of each tabBar controller's view starts just below the imageview.Everything is fine for the portrait mode but as soon as i rotate the device the imageview dissappears.And when i again come to portrait mode the imageview does not appear and the tabBar controller's view starts from the top.

I tried it every ways(like tabBar instead of tabBar controller etc.) but fail to achieve anything helpful.

A: 
  1. I've never heard of that problem before. Can you paste some code? Also, are you sure that the tabs on the view more page work correctly?

  2. In order for a TBC to rotate, all of the root view controllers of each tab must support rotation. In each of those files make sure shouldRotateToInterfaceOrientation: returns YES for all orientations (if you're using the default iPhone VC template take out the if(interfaceOrientation == UIInterfaceOrientationPortrait) statement and associated brackets).

  3. I've actually done this before, and trust me when I say you're opening up a can of worms. To achieve this you need to add the TBC as a subview of a view that has an imageview on top. You must manually set the TBC.view frame to not cover up the top image. The best way to do this is: in the .xib for the container file, add an image view up top, and under it another view. Connect the view to the code via an IBOutlet, and set that frame as the TBC.view.frame. Then add the TBC.view as a subview programmatically.

    With this solution, however, you must add in a willRotateToInterfaceOrientation:duration: method that calls the same function in all the TBC's viewcontrollers, and all of those viewcontrollers must be navigation delegates that call viewWillAppear: and viewDisappear: manually. The rotation is also a bit "sticky" when you do this, so beware.

    My suggestion: don't put a static image up top. It causes a lot of issues, and takes up a lot of screen real estate, especially on the iPhone's smaller screen. Look at The Weather Channel app if you want to see how bad it looks.

Let me know if you have any more questions!

MishieMoo
Thanks MishieMoo.The solution to the third point seems totally convincing.But for the second point I have returned YES in shouldAutorotateToInterfaceOrientation.As far as the point 1 is concerned:--- when i set set my extra tab's controller(other than the 4 shown in tabbar) to be the viewController and not the navigation controller then it works finebut with navigation controller things went awry
anurag
For point 1 why did you want to have your nav controller as the root? From a UI standpoint, that's an issue because then if they click the "more" button while inside one of the more nav controllers it couldn't load that tab because that's where you are, hence the issue.As for point 2 it's possible that the root view of the More navigation controller won't rotate, and you have no access to that. Have you thought of cutting down your tabs or making a custom more page?
MishieMoo