Swift - UINavigationBar is disappearing - Storyboard reference - ios

I'm havig this navigaton bar at the very beginning of my project, I'm hidding it at connection and then displaying it later on.
My sotryboard began to get huge so I've decided to put the parameters views of my app in a second storyboard.
The second storyboard begins with a view (that I'm displaying using "Presentr" library) which has already no access to the navigation bar from the first storyboard.
I think that the storyboard reference is somehow destroying my navigationController.
What am I doing wrong, and what should I do to correct it ?

My issue was because of library "presentr". Somehow when I'm using this library to dsplay a VC (no matter how it's linked into the storyboard), the VC loses the hierarchy with the navigation controller.
Hope it'll help

Related

Can I use a single navigation controller to the multiple storyboards?

I am using two storyboards Main and StoryboardA. For Main.storyboard i have embedded a navigation controller. From Main.storyboard i need to go the storyboard StoryboardA. So for acheiving this i have given a storyboard reference. But the problem is i am not getting the back button on the StoryboardA . It seems the StoryboardA is presenting itself instead of getting pushed. Please see the below image: So My question is do we need to use another navigation controller for StoryboardA?
Main Storyboard:
Second Storyboard:
I seem to have found a solution mired in all of these solutions for old versions of iOS and Xcode. In short, in your second storyboard, mark your first view controller as "Is Initial View Controller", not the navigation controller.
Your navigation controller will remain and still point to your first view controller. I wonder about downstream issues yet to appear but others seem to have had success.
Have you added segue as push ? On control click - > Select segue type as Push .It should work fine.
You can use a RootViewController for many StoryBoards but you can use only one Storyboard for a NavigationController

Popover View Does Not Show Subviews

I have an iOS app that was created using storyboards with auto-layout. The View Controllers are in a navigation controller. Several steps down the navigation controller chain I have a button in VC1 that is connected to VC2 via a popover segue. When I tap the button, a popover view appears but is blank. I changed the background color of VC2 to see if the view was actually appearing. It was. No subviews were visible. I have created and recreated VC2. I have changed the sizes of the view, the subviews and the view controller. I have manually and automatically created restraints. I also created a test view controller outside of the navigation view controller. It behaved the same as the view controllers in the navigation controller.
Just to check if I was completely incompetent, I created a new project with a storyboard that had one VC. I placed a button in this VC with a popover segue to a second VC. It worked as desired. When the button was pressed a popover would appear and all subviews of the second VC would be visible. I tried placing the first VC in a navigation controller with no change. It continued to show the popover as it should. I have compared the two projects and I can't find what the problem is.
My question is this: Does anyone out there know of some hidden setting that would cause this behavior? or Any suggestions on what I'm missing here?
Well, after a whole lot of time (and even rewriting my project from scratch) I finally found the solution. Apparently, using size classes messes with popovers. To solve this solution, I turned size classes off completely. My app is iPad only so that worked for me. According to this thread: iOS8 Size-Classes and Popover Views you can also use the Any/Any size class. I was using Regular/Regular size class. I hope this helps someone.

How to link a separate storyboard to each particular tab in uitabbarcontroller?

I have an app which has 5 major user flows..each flow is a few screens linking to each other...so each flow warranties its own storyboard. Each storyboard starts with a custom view controller that is embedded in a navigation controller. So far so good.
Now all of this is "stitched" together via a UITabBarController. This is the most default UI design ever known to iOS.
But turns out I don't really know how to link from tabbarcontroller, which is in its own storyboard (that is set as the main one on code project) to any of the other storyboards.
This problem looks so! simple, so I think I am missing something utterly obvious, but I just can't figure out how to do it.
So how do I link from tab bar controller in storyboard 1 to the initial view controller in storyboard 2 when a tab is tapped?
You should do this in code. You can have the tab bar controller (tbc for short) and the controller in the first tab in the app's main storyboard, and in the app delegate, instantiate the other controllers using instantiateInitialViewController. Create a mutable array by copying the tbc's viewController array, add the other controllers you instantiated to it, and then set that array as the tbc's viewControllers array.
You have to add your viewcontroller programmatically in tabbar.

Xcode 6 Segue with UINavigationItem

I've just created a Segue from a ViewController (which is embedded in a UINavigationController) to another ViewController. It seems like that the new Segue types do not create the UINavigationItem (which contains the title label) on Segue creation as the push Segue type did in iOS 7. I've noticed this fact because I couldn't enter any title for the "new" ViewController after I created the Segue. There is also no place where I can properly place a bar button item.
I couldn't find anything regarding this fact in the Segue documentation so I was wondering if the UINavigationItem isn't automatically being created anymore. It doesn't even show up in the document outline. Does somebody know something about that? Maybe it's just a Xcode Beta 3 issue?
Here is a picture of the segue in the attributes inspector:
It seems like a bug, it normally fixes it self after restarting Xcode but quick fix is just to drag a navigation item from the object library onto the view controller.

Switching UINavigationViewController to UITabBarController with Segues

I am changing my app to use UITabBarController instead of UINavigationViewController. I replaced controllers accordingly and app launches with tabs successfully. Later in the code I came across some difficulties using segues where lines like
[self performSegueWithIdentifier:#"ImageViewController" sender:self];
won't work producing error
"Push segues can only be used when the source controller is managed by an instance of UINavigationController"
When I embedded UINavigationController into the initial FirstViewController, line above worked fine. I need that line to switch between views and pass some data to another view controller.
The problem is that using segue identifier to go to SecondViewController hides TabBar navigation (unless I wrap SecondViewController in UINavigationController again and so on). That is not the solution.
Question: How to use UITabBarController and still take advantage of segues while keeping tab navigation visible?
"Push segues can only be used when the source controller is managed by an instance of UINavigationController"
Sounds to me like you are using a push segue somewhere outside a navigation controller. Try to select all "segue bubbles" in interface builder that are not inside a navigation controller:
and check the segue's style in the right pane:
If the style is set to the value push as shown above change it to modal or custom:
There is something wrong with your connections. If you are using interface builder (storyboard) then your connections should look like this. See pic
Notice you are missing UINavigation Title headers. Also the gray area below on each view controller means that space is reserved for images for UITabBarController
Another problem is your UIToolBar. Looks like its sitting on top of where UITabBar will be displayed. That may/may not get your app rejected by apple since you already have a UINavigationController and UITabBarController. If you need more buttons/options on that page make them UIButtons instead.

Resources