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.
Related
So i currently have a ViewController that has a tableView in it with a tab bar on the bottom. Its basically an instagram clone. However, i built all the tableView functionality and am now just getting around to playing with the tab bar items to segue to new view controllers.
I cant figure out how to attach my already created tab bar(which is inside a regular view controller) to other view controllers in IB.
The ctrl+drag from the newly created view controllers to my MAIN view controller doesn't work. It doesn't provide an option to create a view controller segue.
Below is an image of my current view controller and a brand new one to the right
Any help on how i can do this would be greatly appreciated
On you tabbbar controller ctrl+click and drag to the view controller you want to create a relationship to.
Then when the little menu appears, under 'relationship segue' click 'view controllers'
You should then end up with something like this. Continue the same process to add more relationships.
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
I have have a view controller that is embedded in a UINavigationController and I want to segue to another view controller that is also embedded in a different UINavigationController. If I try to use a push segue, I get an error saying that I can't push a UINavigationController. However, I don't think using a modal segue is appropriate. How should I go about this?
How should I go about this?
You should use a single navigation controller.
the problem is that I want different bar button items for each view controller and they won't change
Each view controller can set up the bar buttons however it likes. Take a look at UINavigationItem. Each view controller has a navigation item, and the navigation item has various properties such as leftBarButtonItems and rightBarButtonItems that you can use to set the buttons.
I'm trying to implement an unwind segue that will take me from the last view controller back to the todo-list controller.
Here's my storyboard
Without the tab bar controller, the unwind segue works fine. However, as soon as I add the tab bar controller, the unwind stopped triggering.
What am I doing wrong?
Thanks
Edit: Also, actions created on the bar button in the last view controller do not trigger when the tab bar controller is implemented
I have had a similar situation and I was able to resolve it by setting the Modal segue to "Presentation: Current Context" instead of "Default" in the Attributes Inspector (screenshot here: https://cloudup.com/cHFyH8OOY9D).
That is, the segue arrow between the Table View and the second Navigation Controller in your screenshot above.
I've had a similar issue with unwind segues not being called with view controllers within a TabBarController.
The solution is to create a custom TabBarController class, and have the unwind segue action in that class. You will then be able to pass a message to the current tab bar view controller.
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.