Update UINavigationController when clicked on menu - ios

This is my current storyboard.
I have an initial view (Activity) embedded into a Navigation Controller, which has a top left navigation item (barely visible button) which segues to a menu (Guillotine Menu View Controller) with different options. How do I set this up to open a different ViewController embedded in the same navigation controller when I click on an option in the menu?
BTW I am using this library as the menu view controller.

You can do it as follow:
New your different view controller in the storyboard.
Cmd+drag from the button to the view controller.
In the pop-up menu, select the "push" segue.

I think you need a way to make the menu push new viewcontroller to the navigation controller that presented it. I have an idea but I can't try it now, you can try it and tell me if anything isn't clear
1- Add delegate properety to your GuillotineMenuViewController
2- In prepareForSegue in your viewcontrollers if the segue is for displaying the menu, set the menu delegate to self
3- Make menu buttons' actions call the menu's delegate with the name (or better the storyboard ID) of the viewcontroller it should push
4- In the delegate function close the menu, and check if the viewcontroller isn't the one already on top, instantiate it with the corresponding storyboard ID and push it

Related

I want to add more tab bar than two

I want to add more tab bar than 2 and I tried the make segue between the main storyboard but I can not succeed.Summary how can I add more tab bar?
If you wanna add more View Controllers via Storyboard:
Select your UITabBarController
Press down Ctrl key (hold on)
Drag to another View Controller (hold Ctrl)
Select view contollers in Relationship Segue
Result
If you wanna create UITabBarController with Storyboard Reference you can use this approach:
Add TabBarController to your Storyboard.
Remove added View Controllers.
Add Storyboard Reference as many as you need
Select view contollers in Relationship Segue like in first approach

Navigation bar missing in storyboard with show segue in Xcode 8

Why can't I see the navigation item under my second View Controller? My setup is as follows: I have a view controller embedded in a navigation controller. This view controller is linked to a second view controller with a "Show" segue. I can select & edit the navigation bar for the first view controller, but cannot see it in the element list for the second view controller. I also cannot edit it in the second view controller (i.e. add a button). How can I fix this?
First, drag a navigation item under your second view controller:
Then, you have it to edit:
How can you link the firstViewController and secondViewController? I try to link and I only can link the firstViewController and secondViewController in there.
But, this link is error, I set the different color for two viewController, the secondViewController cannot display.
So, you lost Navigation Bar? Select the View Controller you want to add and click on Status Bar / Top Bar dropdown list in Attributes
Inspector.
This is a known bug on Xcode, you can manually drag a Navigation Bar to your Second ViewController.

How to show a view controller using a navigation controller segue, including back segue (Swift)

I have to view controller, One has a button and the other is embed in a navigation controller. I Don't know how to make a proper segue to that second view controller including a back (unwind) segue. That is in swift.
You're going to use a navigation controller. Go and select your view in the storyboard, and select Editor -> Embed In -> Navigation Controller. Do the same for the second view. Now, add a button in the first view that connect to the second view on a click. Make sure when you drag and drop that it's a push segue.
Voila! You should now have your navigation controller working.

How to link items from a tabbar item to another viewcontroller

I have a UITabbar and added additional UITab Bar Items. I then want to link (create a segue) to another view controller, but when I drag to create a segue, I do not get the popup menu letting me choose between 'push' and 'modal'.
How can I create a segue to another view controller?
It is not possible to create a segue inside the Interface Builder using a UITab Bar Items, it has to be done using a UITabViewController (dragging directly from it).
A workaround could be to do it programmatically, listening when a item is selected inside the UITabbar and use the pushViewController:animated: method from the navigation controller to make the push, but not sure if this will work.

In an iOS 5 Storyboard, how do you push a new scene to the original view controller from a Popover?

I'm creating a popoverSegue from a new view controller and want to push a third view controller onto the original stack. This is how I'm creating the application:
Create a new Single View Application
Select Use Storyboards
Select the MainStoryboard.storyboard file.
Select the only View Controller, change the Title and Identifier to initialView, then select Editor->Embed In->Navigation Controller
Drag two new View Controller objects from the Objects Library onto the canvas
Change the Title and Identifier of the new View Controllers to: popoverView and newView.
Add a Round Rect Button object from the Object Library to initialView and popoverView.
Add a Label object from the Object Library to `newView.
Control click the button in the initialView and drag to popoverView.
Select the Popover option from the Storyboard Segues menu that appears.
Control click the button in the popoverView and drag to the newView.
Select the Push option fromt the Storyboard Segues menu.
Build & Run.
Click the first button, and the popover appears, but when you click the button within the popover, nothing happens (it should push the new view but doesn't.)
What I want to do is for it to push onto the Navigation Controller stack, but am not sure how to setup the storyboard for that.
Any ideas?
You're expecting the UINavigationController hierarchy to extend itself into a presented popover. It won't. The same goes for presenting modal view controllers. If you were to log self.navigationController in popoverView, you would see that it is nil.
Embed popoverView into it's own UINavigationController. Remember that if you're overriding prepareForSegue:sender: and attempting to configure the popover, you will need to get the topViewController from destinationViewController as the destination is now an instance of UINavigationController.
Sounds like it should work, but if it doesn't try the following:
1. Click the segue that doesn't work and give it an identifier. Let's say it's PopoverToNewSegue.
In your implementation file for the popover view controller, add an action when the button is clicked.
That function should return void and add the following line:
[self performSegueWithIdentifier:#"PopoverToNewSegue" sender:self];
That should get your segue running. I've noticed that segues don't always work like you expect them to, but this one works for me without fail.

Resources