I'm presenting a UITableView modally to provide access to some application settings. When the modal view (root view controller) appears, it has a navigation bar like I expect. However, when one of the options is selected and the next 'UITableView` is popped to the top of the stack, there's no navigation bar.
Here's what one of the child UITableViews looks like:
As far as I know, the two children views should have navigation bars without me having to do anything because they're embedded in a UINavigationController.
I tried dragging a navigation bar to the views but IB will only let me put them inside the UITableView and if I do that, they do appear, but they also go too high in the view and run into the status bar and I can set any layout constraints on them to fix this.
I've scoured the Apple documentation with no luck and found many thread on SO that very, very old and in objective-C.
Can I make these views work together like I'd expect them to or am I going to have to build the child views from scratch?
UPDATE: I'm still trying to get this to work. I've now tried to create a new view controller from scratch. Here's what the view hierarchy looks like:
And you can see in the Storyboard something's not right:
And when I run this in the simulator, I get a new error:
"[UITableViewController loadView] instantiated view controller with identifier "UIViewController-cDg-wV-aMN" from storyboard "Main", but didn't get a UITableView.' But I created the segue by Ctrl-dragging from the cell in the root VC directly to the Table View.
To sum this all up, here's the flow I'm trying to achieve: UIViewController (initial VC) -> UINavigationController (presented modally from the bottom) -> UITableViewController (presented from right to left and with standard navigation bar).
My segues are all set to Show (e.g. Push)
Any help or suggestions would really be appreciated.
Well, I figured out how to fix the problem I was having after coming across another thread that wasn't about the same problem, but it had some advice that tipped me off.
The problem was caused by me creating the segues from the UITableViewCell on my Settings view controller to each of the child UITableViewControllers.
To fix the problem, I simply created the segues between the Settings UITableViewController and each of the child UITableViewControllers.
Hope this helps somebody else someday.
Related
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.
This is driving me crazy! I am creating a segue from one of the UITableViewCells to another UITableViewController. A Navigation controller sits between them as shown in the screenshot below:
When I reach the Samples UITableViewController it appears without the NavigationBar as shown below:
Am I doing something wrong?
Your first UITableViewController is in a navigation controller too right ?
If not, it's normal, see this post.
If your first UITableViewController is in a navigation controller, I had the same problem, if you use the push segue (deprecated) it should resolve your problem.
I've looked around and been unable to find a clear example/explanation of how to do this. I've just started with swift, apologies if any terminology is off.
What I'm looking to do is add a NavigationController to one of my TabBarItems in a way that I can view multiple views from utilizing the NavigationController while still staying within that TabBarItem view
So far I have the TabBar created, with three items. I don't mind doing it in either storyboard or programatically.
In the storyboard give each page view controller it's own navigation controller and make the navigation controllers the view controllers pointed to by the tab bar controller.
Do it like so:
https://stackoverflow.com/a/26153273/1527064
I'm new to iOS, but I know the basis. I want to host 3 UITableViewController in a UITabBarController using the storyboard.
I dragged a UITableViewController from the object list(?) and control dragged creating a seguel. Now the tab shows successfully the table view controller.
The issue is the rows are taking the space of the status bar. So I want a navigation bar(?) there, with a title. Since I'm new to iOS I don't know the following:
Given the fact that UITabBarController is the first controller ever, the hosted UITableViewController should not have a back button, obviously. So is it correct to use a navigation bar to display a title (and possible add/edit buttons)
If so, I tried dragging the Navigation Bar but it doesn't work.
What am I missing or doing wrong?
hope this helps
actually it is done for another answer. but it will be handy to u too
You will want to add in 3 UINavigationControllers. Have each tab in the tab bar controller segue to a different navigation controller. Then set the root view controller for each navigation controller to one of the table view controllers.
I have a UITabBarController inside of a UINavigationController which originally had the navbar hidden before the view when the tabs were needed, though when I try to show the navbar inside the file nothing happens and if I do it just before the transition then it appears before I have pushed between the two controllers is there a way to stop this effect and make it so that when the next ViewController loads the navbar is on it when it appears?
This is not an OS specific issue as it occurs in iOS 6 and 7
The UITabBarController class is not designed to be used as a child of a UINavigationController, which might explain why you're seeing odd behaviour. If you absolutely need a tab bar within a UINavigationController, you'll probably have to roll your own. Otherwise, make your UITabBarController the window's root view controller and populate it with navigation controllers.
Managed to work it out though gave conmulligan the credit because he gave me the idea which was to keep the navigation bar hidden and to embed the viewcontroller inside a new navigationcontroller so there was a whole new navbar