I am using storyboard, navigation controller in iPhone application. Then navigate it to another view where I have used Tabbar controller. Then in Tabbar controller, I've 3 tabs and each of them have their separate navigation controllers.
Now, After completed process. But when I navigate to Root, it does back with its own navigation controller inside of Tabbar controller.
Actually, I want to come back on main Navigation Controller of an application where application starts.
Basic Flow :: Main Window -> Navigation Controller -> Tabbar Controller -> Navigation Controller -> Button..
So by clicking on Button -> Back to Main Window... Any Idea to back to main root view.
But I'm stuck with this issue for navigation controller that can't back me to the application root.
Can anyone solve this issue?
Please tell me ASAP.
Thanks in advance.
Not really the answer you're looking for, but FWIW:
You should avoid hiding tab bar controllers inside other controllers so that the tab bar controller appears and disappears. This isn't how they are meant to be used. They're supposed to be a main part of the UI and if I see a tab bar controller I expect it be there at the heart of the UI, controlling access to the main parts of the UI, and visible pretty much all of the time if not all of the time.
Don't take my word for it, listen to Apple:
Appearance and Behavior
A tab bar appears at the bottom edge of the
screen and should be accessible from every location in the app. A tab
bar displays icons and text in tabs, all of which are equal in width
and display a black background by default. When users select a tab,
the tab displays a lighter background (which is known as the selection
indicator image) and its icon receives a blue glow.
Don't be terribly surprised if your app gets bounced from the app store for ignoring the human interface guidelines!
It's resolve with ::
[self.parentViewController.navigationController popToRootViewControllerAnimated:YES];
Enjoy coding..!!
Related
Attached are two images. The first shows my current main.storyboard, and the second shows my problem when I run the app. I have a tab bar controller that has two tabs. On the first tab there is a button. When pressed, the button goes to another view controller with content. At the top is a Navigation bar with a back button. After viewing content, I press the back button, and am back on the original page with the button, but the tab bar is missing. I have seen a few answered questions, but it appears they made their tab bar in the view controller instead of the storyboard. Another says that I should never return to a previous view unless I use an unwind segue. Is this true? If so, how do I set up an unwind segue. If not, how do I fix this problem otherwise? Thank you.
http://i.stack.imgur.com/IYmX2.png
http://i.stack.imgur.com/7slt5.png
The problem is in the wiring of your ViewControllers. You have probably embedded your UITabBarController inside the UINavigationController and not the other way around.
A correct layout looks like this in Interface Builder :
To reproduce:
In Interface Builder drop a UITabBarController. This will come with 2 UIViewController's already wired in.
Pick one of the UIViewController's (let's call it VController1) and click on Editor / Embed in / Navigation Controller. This wires the VController1 to live inside a UINavigationController that is inside the UITabBarController
Add a 3rd UIViewController next to VController1 Let's call it VController3
Wire in a segue between VController1 and VController3, for example with a button.
I hope that's clear enough
Try Linking the button in your viewcontroller (other than the views of the tabbed bar controller) with the tabbed bar controller. Create a segue that links the button with the controller of the tabbed bar application
I am working on an application that uses a UINavigationController. The root view controller of my navigation controller is performing a search similar to the Email Application. When I press on the Search Bar I hide the NavigationBar. While I display the results, my Navigation Bar is still hidden, and when I tap on one of the results I want to push a new view controller on the stack. The problem is that if I make the Navigation Bar visible it animates really funny, falling from top. I want it to act exactly like in the Email app, to come naturally from the right, already placed on top of my pushed view controller. And, when I press back I want to present my root view controller in the same state:with the search bar "over" the navigation bar. I hope I am making myself as clear as posible.
Thank you!
I have a tab bar controller whose 2 tabs both contain views with navigation bar controllers. When I display the app in portrait everything is fine, however when I display just the first tab in portrait, then rotate the device and display the second tab in landscape, the navigation bar of the second view stretches while the first stays in 'portrait size'. I have been able to replicate this in a basic project that I've uploaded to rapid share
I am guessing this is a easy fix.
Thanks in advance!
Found the answer. I had a view for each tab with a navigation controller within that view. By changing the tab view to a navigation controller instead, resolved this error.
Basically, my original setup was tab navigator -> view -> navigation controller
This I changed to tab navigator -> navigation controller
It works correctly now.
I guess I'm just really looking for some advice on how to approach my problem.
So far I have an application with a navigationcontroller that has a table view.
Every cell in the table has a text field and image and a disclosure button.
This is sort of my main menu option navigation screen.
When a user clicks a disclosure button I would like to go to a sub view of a tab view controller. The tab view will show different content depending on what cell is selected.
I'm guessing it would have something to do with the accessoryButtonTappedForRowWithIndexPath but after that I'm a little lost.
I've only ever experienced tab controllers from an example in a book where the tabbar controller was dragged onto a window in interface builder.
I'd like to try and pin down a direction to set to work to
I would highly recommend re-thinking your use of the tab bar here. The tab bar is intended to be a top-level control for navigating logically separate parts of your applications. Normal use would be tabs that contain navigation controllers that drill into detail within the navigation.
You may consider changing to use a toolbar rather than a tab bar. The toolbar is intended to change for the context of your current view. You can define the toolbar items in the view for the current navigation bar very easily.
All that said, if you are still set on using tab bar, I would keep the tab bar at the top level of your application and use setViewControllers:animated: to change the tabs when necessary. Again, I think this will end up producing a pretty confusing UI however.
I am trying to make a program with three subviews after the title screen. Two of the views are just standard nib files with UIViewController subclassed to control them, and the third is a Tab Bar view. I can't seem to get the tab bar items to display though. I walked through the Tab bar chapter in "Beginning iPhone Development" which adds the Tab Bar Controller right off the bat as a subview of Window in the app delegate and that works fine. What I want to do though is load up my rootView controller after the third section was chosen from the title screen and then add a Tab Bar view to that. Every time I do this though I get a blank Tab Bar with no tab bar items.
Any help you can provide would be greatly appreciated seeing as I've been working at this for a few days now.
Thanks
You can't push a tab bar controller to a navigation controller, which I assume is what you're trying to do. However, you can use a plain UITabBar and implement your own view switching in a UIViewController subclass (rather than a UITabBarController). See this related question.