I want to create two relationships(as segue) UITabBarViewController to SecondViewController via navigation controller. But these options depend on the selection on the FirstViewController. How can I do that?
Your question is a little bit weird, but I'll try to give you an answer based on what I understood.
If you want to create a UIStoryboardSegue programmatically, you cant! Segue can only be created inside storyboard.
If you want to transition from a viewController to another programmatically, you can use two method: pushViewController (of UINavigationController) or presentViewController (of UIViewController, that present a controller modally).
EDIT:
if you have already set the segues in storyboard, you can trigger them using performSegueWithIdentifier
Related
I have an iOS app written in Swift with UITabBarController with 5 UIViewControllers. Now, I have a bunch of UIViewControllers that are not part of the UITabBarController. I'd like to be able to show that same tabbar but I have no idea how to do that. Any clue?
More details: This is one of the View Controllers that the tabbar has. I use storyboard references and split my view controllers into separate more manageable storyboards.
So, the big picture:
There's no initial ViewController since I use storyboardId to get to the initial Navigation Controller. From there we have a ViewController embedded in the same Navigation controller. In that ViewController, there are 2 Container views - one of the size of the bottom ViewController that contains the "hamburger" button that toggles the other Container View which has an embedded UITableView in. When a specific cell is selected it should go to Profile ViewController that's not even in the same storyboard. The segue is set to be Push. Either way, doesn't show the UITabBar on the Profile ViewController
how you doing?
I don't know if I understood, but you are trying to show tabbar after going to another screen, right? If the answer is 'yes', try to change your segue to show(e.g. push).
-----Edit-----
You can do with two ways:
Presenting Modally -> using Current Context
Use push(e.g.) with a navigation view controller, you can also hide the navigation bar if you go to Navigation controller -> Attributes inspector -> Navigation Controller -> Uncheck Shows Navigation Bar
Hope now it works!
Best regards
Instead of control-dragging every cell to the other view controller, is there a way to make them all segue to the view controller more easily? I would also need to add a Segue Identifier to the individual segues as well.
That is exactly why you have a tableview delegate method.
– tableView:didDeselectRowAtIndexPath:
whatever cell in the table this method will get invoked and there you can call for whichever transition like push,model etc programmatically in code.
This sounds like something you should do programmatically rather than in interface builder. You'll want to set the selection action for the cells to trigger the Segue.
You can create a manual segue from one view controller to another. Just select view controller from the bottom bar (where you see first responder and all) and ctrl drag to other view controller. Select the segue and give it a unique identifier (TransitionSegue in this example) from attributes inspector. From code call the segue whenever you want a transition.
[self performSegueWithIdentifier: #"TransitionSegue" sender: self];
Hope this helps.
Im using Storyboard for most screens in my iPhone app. However, I have one screen in my storyboard where I dynamically load a XIB an embedded it within the main view. This XIB have an image and some text and is connected to its own UIViewController.
My problem is that when I tap on the image in the XIB I want to segue to another UIViewController in my Storyboard. However, because my XIB is not in my Storyboard (its dynamically added at runtime) there is no way I can connect my XIB's view controller with a segue.
I'm getting the error "Receiver () has no segue with identifier". This makes sense because the segue is not connected so is there anyway tha tI can programmatically segue to the other view?
I've seen examples where I can have a modal transition, but instead I would like to have a "push" transition.
Thanks
Brian
I don't know if I really understand your question, but if you want a push transition, use this:
[self.navigationController pushViewController:someViewController animated:YES];
I have a TabBarController in which I have 5 tabs to access. In one of the tabs I have a Navigation Controller and then the stacks. The navigation controller is being set through IB at this point and the viewcontroller in there is also. Now my concern is that, how can I redraw something based on that particular tabbar as the tableview is not reloading the data since viewWillAppear is not being called when I am in that particular tab.
I am trying to analyze as what is the best way to trigger being in such active tab to trigger such routine. I tried tabbarcontroller didselectviewcontroller delegate pattern in my viewcontroller, and have linked the delegate in my IB from the navigation controller to tabbarcontroller.
However such delegate is not getting triggered when I am in that particular tab item. Any suggestions at this point will be really great?
Thanks
So I have a UITabBarController, and in one of the tabs I have a UINavigationController. I need to know when the UINavigationController shows and hides. I'm wondering what the best way to do this is.
I can use the UITabBarDelegate to determine when a user clicks on that tab, but often the user is sent to this tab by another means. I can also use viewDidAppear or viewWillHide in the specific view controllers within the UINavigationController, but I want to know when they UINavigationController as a group shows and hides, not any specific view controller within.
Huh. Is there an instance method of the UINavigationController class that looks like this:
[instanceOfNavController isFirstResponder];
You should check the developer documentation for such an instance method.