Keep UIView while animating navController - ios

How can I animate in a new uinavigation controller but keep the same uiview in the window?
I've seen this done in the opposite - a navController stay in place while a container view changes a view controller as a child view controller, but I want the opposite:a main view, a mapview, to remain in the window at all times while a new vc2 slides in from a push segue which will show a different navBar title and uibarbutton items. This is important because I need the mapview from VC1 to replicate in VC2, or to that effect.
Can this be done and how? Thank you for suggestions all,

It would probably be better to do this without a navigation controller. You can create a custom container controller with a navigation bar at the top. You can add vc2 as a child of your container controller, remove the map view from vc1, add it to the view of vc2, and remove vc1 from the container controller. This would all be done with no animation, so the user shouldn't see anything happening in the main view. You can call pushNavigationItem:animated: on the navigation bar to animate in the new navigation item.

Related

How to keep NavigationController when performSegue from embeded tableviewcontroller

In the bottom left viewcontroller i have a searchbar at the top that call the tableview at the top , the problem is that i want to segue to the right viewcontroller with detail of it, but of course i'm losing my navigationController so when i'm into the right viewcontroller i can't go back anymore, how should i do to go back to my original Viewcontroller ?
Add Navigation Controller as the starting view in storyboard. And then Link RootViewController to it. This will ensure navigation bar in all the views coming next.
you may hide navigation bar in the view where not needed as
self.navigationController?.isNavigationBarHidden = true
push newViewController instead of presenting
Also please check, if you are presenting it modally. Modal segues take over the whole screen, so any navigation bars, tool bars, or tab bars that are in the presenting controller will be covered up. If you want a navigation bar on this modal controller, you'll need to add one specifically to it, and add any buttons you want to that new navigation bar (or tool bar). If you don't want to do this, then don't present it modally, do a push to it.

Navigation Bar not showing in embed Navigation Controller

I'm trying to display the navigation bar at the top of the screen, but it's not showing in embed navigation controller.
Here is how it is in the storyboard:
And here it's in the simulator:
As you can see, I created a custom TabBar (following this tutorial) at the bottom of the screen so I can navigate between the different views.
I believe that I'm going to have to load the navbar programatically because the only solution that I found was to set the navigation controller as the initial view controller, but I already set another view as the initial one so I can't do that.
Issue :
When you instantiate a viewController using storyBoard identifier they wont come with free embedded navigation controller, even if you have added a NavigationController to them. As a result you are adding a viewController without navigation bar to your tab bar VC.
Solutions:
Solution1: If you want each child viewControllers to carry their own navigation controller hence their own navigation stack, provide a storyboard identifier to Navigation Controller behind your child viewControllers and instantiate the Navigation controller itself rather than ViewController. And add NavigationController as you tab bar looking VC's child. Because navigation controller loads the embdedded VC by default you will see your child VC with nav bar.
Solution2: All that you care for is only nav bar than add the Navigation Controller behind the VC containing tab bar looking View.
Hope it helps
Have you tried constraining the navigation bar to your view? Otherwise it can move offscreen.
You need to point the tab bar controller segue to the navigation controller of your view - otherwise if you point the segue straight to the view you're just loading the view without any navigation controller attached.

How to pop UIViewController when no NavigationController?

My initial scene has a navigation controller embedded. This scene links to a UITableViewController scene. The tableview scene doesn't know anything about the navigation controller.
In the tableview scene, I've added a navigation bar and left button called back. How do I get back to the previous scene?
I have the following action associated with the back button:
self.navigationController?.popViewControllerAnimated(true)
But it doesn't do anything because self.navigationController is nil.
If your navigationController is nil, then your scene must have been displayed modally, not pushed onto a nav controller. Instead of popping it, you have to call dismissViewController on it.
A better approach than using a left button item to navigate is to use the nav bar's built-in functionality by setting a custom backIndicatorImage and mask.

Push navigationController while persisting a UIView

I am using a navigation controller to push from vc1 to vc2. I have a mapview in vc1 which I want to also have replicated in vc2, so that it appears that essentially only a new navigation bar animated into view and the mapview didn't ever move during the transition to vc2.
I've tried setting vc2.mapview = self.mapview in vc1 prepareForSegue, but I didn't like the transition. I've tried custom modal segues too to overlay the mapview with a clear background in vc2, but then the map won't detect touches.
This is similar to the problem Tariq had here (iOS - pushViewController without sliding Background Image), but for me I need to be able to still interact with the mapview in vc2.
Any suggestions at all are welcome, thanks!
Try to find a way to split window in 2 view controllers. One on top and one bottom.
The top one should have navigation controller while the bottom one only the map.
Make some links between them and you're done.
Or you can use UITabBarController

Modal Segue Into Navigation Controller with No Nav Bar

In my storyboard I have a view with a segue into a new view that's embedded into a Navigation Controller (so the segue points to the navigation controller). I have the segue set to a Modal transition, however when the new view is animating up, it contains the standard blue navigation bar above the view (which then animates out of view).
Here's what it looks like mid segue: http://i.imgur.com/3eqAQ.png
How do I make it so the modal view animates up but without the navigation bar?
I have tried hiding the navigation bar in the embedded view's init, viewWillAppear, and vieWillLoad methods and that doesn't work.
I event went so far as to create a custom subclass of UINavigationController and set the navigation controller in the storyboard to it.
Thanks!
This may sound pretty simple, but have you tried hiding the navigation bar immediately before the modal segue starts? I had this problem when presenting a modal view controller and adding a [self.navigationController setNavigationBarHidden:YES] immediately before the presentation did the trick for me.
I had almost the same problem, but I wanted to get a navigation bar for my modal transition, as it was always hidden.
There may be two ways for you to remove the navigation bar:
Make sure that your view controller is not embed in a navigation controller, as it would put one by default
Check the "Top Bar" attribute of your previous controller in the workflow and work with none/inferred values depending on your storyboard.
Regards

Resources