Is it possible to have the following "view" structure?
1) RootViewController is a UITabBarController.
2) One of the "Tabbed" views is a UISplitViewController.
3) The "Detail" view of the "SplitViewController" is a UINavigationController.
What I'm trying to accomplish is the "Detail" view can create a sub view that has a "back" button.
The problem is calling PushViewController(newView, true) in my "Detail" view never displays the newView.
A UISplitViewController must the the top level controller.
See here: Split view controller must be root view controller
Instead of using a UITabBarController at the root, you should just use the split controller.
The detail and master sections will both have UINavigationControllers where you can push as many new screens as you need.
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
I have a tab view controller with a few tabs. One tab leads to the "players" view through a navigation controller. A second tab leads to a "settings" view. The settings view has a button to select a "default" player and so it tries to segue to the players view through a separate navigation controller.
Diagram:
Players Tab -> Navigation Controller "A" -> Players View Controller
Settings Tab -> Navigation Controller "B" (w/named segue) -> Players View Controller
The Players tab view does not have a "named" segue as it has a relationship to the tab controller. The settings tab navigation controller has a named segue.
However, now when I select the "players" tab the view is empty! The navigation bar at the top is there with the tabs but that's it. As a test, I removed the relationship from Nav "B" to Players View and now the Players tab is working once again.
I am missing a fundamental issue here but I don't know what.
Any ideas whatsoever is appreciated.
I found a similar question with the answer I needed.
How to create a UIViewController layout in storyboard and then use it in code?
Here is the relevant code:
UIViewController *viewController = [[UIStoryboard storyboardWithName:#"MainStoryboard" bundle:NULL] instantiateViewControllerWithIdentifier:#"ResultsController"];
[self presentModalViewController:viewController animated:NO];
I'm new to storyboards and so I was not aware that this method exists. This method solves the problem I described above. I was initially trying to segue through a navigation controller to a view that already had an established segue. With the solution here I can simply instantiate an existing view using an identifier.
I still think there should be a way to try another segue so that "perform segue" can be used. However, I am moving forward once again.
In my navigation based application, first view is sign in or signup view. After that i am using a view which is using tab view controller. That view has three tab items. Now i want to create a new view and push in navigationController. But its not working. But adding new view as subView in tabBarController View works. I want navigation for subViews for each tabBarItem? How can i do that?
See this
In your case just create three items and make them all UINavigationControllers like the first tab item in the above example.
So I have a Navigation Controller in which for every row select, I push ViewController A. However, ViewController A is another table of items.
So I'm having trouble figuring out how to make ViewController A also act as a navigation controller, in which for ever row I select in ViewController A, I can push a view controller, which, we'll name ViewController B.
I tried to add a Navigation Controller object inside an existing Navigation Controller to no avail.
How will I go about this?
Thanks in advance!
NavigationController has a rootController - in your case this is a some kind of table view controller. When you push view controller A - you use parent Navigation Controller. So you can push as many as you need view controllers via this "parent" navigation controller. Read carefully this section of apple docs
Lets imagine the scenario:
UITabBarController
- UITabBar
- Tab 1: View Controller A
- Tab 2: View Controller B
When I click on View Controller A I want to push another UITabBarController:
UITabBarController
-UITabBar
- Tab 1: View Controller 1
- Tab 2: View Controller 2
- Tab 3: View Controller 3
Is this possible? To have a UITabBarController push another UITabBarController onto the view stack?
You can certainly do this but I would rethink your design. Selecting a UITabBar item and changing the Tab Bar itself goes against Human Interface Guidelines. Besides, in your example, how do you get back to the root view controller?
Perhaps you should use a UITableView that when you tap a cell it pushes a view controller containing a UITabBarController (technically this might go against HIG too since a tab bar should be the same throughout an entire app but I've had plenty of apps adopt this and it seems elegant). So using your example:
RootViewController:
pushed as UINavigationController with a UITableView containing two cells:
"cell1" & "cell2"
-Tapping on "cell1" pushes a view controller containing UITabBar(I) which contains "View Controller A" and "View Controller B."
-Tapping on "cell2" pushes a view controller containing UITabBar(II) which contains "View Controller 1," "View Controller 2," and "View Controller 3."
In each case, you get a "back" button and the UITabBar itself doesn't have to change.
Sure, I just stacked them up in interface builder. There's some frame offsetting issues, but you can see tabbars stacked up. Additionally, the tabbars unstack when other tabs are selected. I also had to make sure the first tab's view was added to the window's view and connected as an IBOutlet, but otherwise that should do it.