Moving a navigation stack to the more-tab - ios

I have a UINavigationController on some tab of a UITabBar. When I drill down into the navigation controllers tableViews, move it into the more-tab, and then select the entry in the tableview in the more-list, i get the viewController that was visible at the time i left the tab i moved. Clicking on the back-button gets me back to the more-list, with no possibility to get back to the initial root view controller.
It would be perfectly okay for me to have the root view controller appear when i click on the item in the more-list, but i have no idea how to get notified when my viewcontroller is moved, since i am developing a library, and so have no reference to the TabBarController.

One of the ways is to implement tabBarController:willEndCustomizingViewControllers:changed: method in UITabBarViewController delegate. And watch for it. If such thing happend then reset you viewController and navigationViewController. This remove your UINavigationController stack, but application will work correctly.

Related

Back button does not appear in viewcontroller

I wish to simply add a back button to the view controller, when accessed from a TableView in my app.
I have embedded the resulting ViewController within the navigation controller, and the back button is simply supposed to appear as documentation notes, but it does not...
Remove the UINavigationController between FriendsViewController and IndividualChatController.
When you push a new navigationController, it creates a new navigation stack with its own navigationBar and therefore you don't see a back button in the navigationBar

Going from NavigationController to TabBarController

So... I've got a ViewController that's being pushed onto a NavigationController. In interface builder I create a separate ViewController and Embed it into a TabBarController and it looks good in Interface Builder.
In my app, I'm trying to go from one of the ViewControllers in my NavigationView to the ViewController in the TabBarController. How would I do this the correct way? I can't just push the view onto the NavigationController, because the tab bar at the bottom won't show up.
Any help would be greatly appreciate.
I believe you're operating with the UINavigationController and UITabBarController in a backwards order to recommended best-practice.
Unless something has changed in the last year or two (which may have happened) the UINavigationController should never have a UITabBarController pushed onto it. If you are using a UITabBarController in your app, it should be the window.rootViewController, and the navigation controller being member of the UITabBarController's viewControllers array.
I'm trying to go from one of the ViewControllers in my NavigationView
to the ViewController in the TabBarController. How would I do this the
correct way?
In that structure, you'd assign your destination view controller as another element of the viewControllers array. Then, in my style, I'd send a NSNotification something like "LaunchOtherViewController" from your first view controller, and thus you have no need for the first view controller to know about the tab bar controller or second view controller. Then have some class that knows about the second view controller receive that notification, and update the selectedIndex of the UITabBarController to that of the second, destination view controller.
Hope that makes sense.
You need to push the TabBarController onto the view. You may need to set the selected view controller of the tab bar, but it's important the tab bar controller be actually pushed onto the navigation stack (or presented modally).

The TabBarItem disappear when I push in other view

I have a TabBarApplication with four views in the main TabBarItem. The problem comes when I go to any of these views and click in any button to go to another view and when I go back by a button linked to the main view, the TabBarItem of the app disappear!!
For example, one view of the app is a tableView in which each element of the list is linked to his external view and it has a back button that should return to the tableView. All the segues are by modal, not push because push segue crash the application and by modal it runs correctly but the problem comes when I returned by clicking the back button of the NavigationItem in the header of the view to his main view and the TabBarItem of the app is not there, is empty.
Each tab should have the view controller set to a navigation controller, with the view controller you want set as the root view controller of the navigation controller. Now you can use push segues and the standard back button that will be added for you. This will bypass the issue (and work much better for you and users).
You current issue is likely related to not really ever going back. Instead, just always presenting new modal view controllers which replace any existing content on screen.

Corrupted UINavigationController with embedded UITabBarController

My app is based around a UINavigationController. On some screens I have a UITabBarController embedded within. When I go to a screen with the tab bar everything works fine on the first tab. (each tab is a UITableViewController) I can tap a cell of the table view and it'll take me to the next page by correctly pushing it onto my nav controller. If I go to another tab it loads the table view fine, but if I tap a cell to take me to another view I get this error:
Nested push animation can result in corrupted navigation bar
Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
It pushes on the next page, but then if I attempt to press the back button on the nav bar the app will crash.
How could I go about fixing this? I looked at multiple other responses to similar problems, but none of them have helped me with this.
It would be really helpful if you share your code.
However this may be helpful for you:
while using tab bar , you should try that every single tab has its own navigation controller and use individual navigation controller to move to specific viewcontrller of specific tab. I know its hard to understand like this..
For e.g in app del you have your main navigation controller using which you push to next view controller ,say "SecondViewController".
Now this second one has got one tab bar with 4 tabs tab1,tab2,tab3,tab4. now each tab can have any no of view controllers associated with them. For e.g on tab1,you move to another screen and again from there to next screen and so on.
So to manage them there should be separate navigation controllers like,tab1nav,tab2nav,tab3nav,tab4nav.
tabBarController.viewControllers = [NSArray arrayWithObjects:"tab1nav".....and so on all nav, nil];
Now depending in which tab you are, use that tab's navigation controller to move to next screen of that tab or move back.
If you have viewDidAppear function,
Remember to put [super viewDidAppear:animated]; inside the function.

ViewController to NavigationController and back

I have one problem for which im not sure how to solve. Currently i have main UIViewController with some buttons. This is the initial view that is created with app. On it, one button calls storyboards segue with style Modal on ViewController which is part of UINavigationController. After that few other viewcontrollers are handled within the UINavigationController via segues and getting back via navigationController:popViewControllerAnimated. What i dont know is how to get back from UINavigationController to first UIViewController. I tried, when I'm on first one on navigationctrl,
[self removeFromParentViewController];
yet that only removes the view but it seems that UINavigationController somehow stays alive as result is black screen. Creating unconnected segue and call it from code would be possibility, but im not sure if that is the proper way. Would that leave navigation controller alive ?
Is there any reason you are using a UIViewController first and THEN a UINavigationController?
Why not change this so that the UINavigationController is the initial view controller and then drive everything from there.
If you want the first view to not have a nav bar then you can hide it easily.
That way you can move around through all views by popping and pushing through the UINavigationController.

Resources