Firstly, I would like to say that there are no errors with my code from a programming standpoint - it runs successfully, so a round of applause for that. However, the issue I am having is that when I run the application, it displays a black screen. I assume the issue has something to do with how I have set up the segues or something similar.
Hierarchy:
Reveal View Controller -> Table View
-> Navigation Controller -> Tab View Controller -> FirstViewController
Important To Note:
Reveal View Controller class is set to "SWRevealViewController"
Table View Controller class is not set.
Table View Controller segue ID set to 'sw_rear'
Navigation Controller class is not set <possibly the issue, but I cannot set the class to SWViewController as suggested by a thread online.>
Navigation Controller segue ID set to 'sw_front'
All other controllers have no set class.
I have discovered the solution. Hopefully others can learn from this.
When you create a project using a Tab Bar Controller as your base, an arrow will appear to the left of the Tab Bar Controller in the Storyboard. Moving that arrow to the Reveal View Controller (View Controller you set to the class of SWRevealViewController) lets Xcode know that you want to start your hierarchy from that object.
I had the same problem. What helped me resolving the issue was to remove the Navigation Controller that linked to the view (in my case was UItableViewController), and re-insert a new Navigation Controller (clicking the tableviewcontroller, Editor > Embed In > Navigation Controller).
Related
Back when I first created the foundational layout for the app I'm currently working on in Storyboard, I did it in two steps:
Selected my View Controller and used Editor->Embed In->Navigation Controller.
Selected my View Controller again and used Editor->Embed In->Tab Bar Controller.
This was the resulting layout:
Question 1: Why do these steps create such an odd layout?
In this weird layout that seems to imply that the Navigation Controller is attached to the Tab Bar Controller as its parent, the only way I can get navigation items to display in the app (in the view controlled by the View Controller on the right) is by placing them in the nav bar of the Tab Bar Controller scene.
However, this creates various issues, including not being able to create an IBOutlet in my View Controller file for a custom view I drag into the title view slot in the Tab Bar Controller scene. Meanwhile, dragging anything into the navigation bar in the View Controller scene just makes it not appear in the app when it runs.
Question 2: How can I fix this layout so that I can control-drag from navigation items into my View Controller file? Or is everything actually correct, and I'm just trying to force something I shouldn't? (My intention here is to be able to set the custom title view's text in my View Controller code.)
Its obvious, if you want to embed MyViewController to NavigationController then you need to change your second step and need to embed NavigationController to Tab Bar Controller.
Selected MyViewController and used Editor->Embed In->Navigation Controller.
Selected NavigationController Embed with MyViewController and used Editor->Embed In->Tab Bar Controller.
It should look like this.
Note: You need to embed MyViewController to navigationController only if you want to perform push operation on this TabBarItem means with MyViewController other wise simply embed MyViewController to TabBarController no need to embed it with NavigationController.
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.
I'm still struggling with navigation bars and just can't work out how to edit or verify that I have a navigation bar on my view and I would appreciate any help.
I have a project with another set of scenes similarly comprising of a navigation controller and three associated view controllers (connected via segues and main table view embedded in the navigation controller) and I was able to add a navigation bar manually in interface builder to the outer view controllers that were segued to the table view controller.
But in this set of scenes the navigation controller is set up as the root view controller for the table view.
I have another set of scenes. A navigation controller and two related view controllers - both table view controllers. I embedded the first table view controller in the navigation controller and I then added a second table view controller to this (for a new screen I want to add to my app) and I connected this second table view controller to my first table view controller by way of a show segue (just like I did yesterday with other set of scenes).
Can I set this other navigation controller as the root controller also?
Like, can I have two root view controllers in a project?
It looks to me like there is a navigation bar visible (see screenshot below) on my new table view controller but I can't click in to it to edit it to add a title to it.
But does a navigation bar and exist, and if so, why can't I click inside it and use it?
I was told in an answer to a previous question that you have to add a navigation bar manually to your storyboard scene to any additional view controllers. I did that yday and it worked. But today when I tried to add a navigation bar by dragging onto scene it wouldn't let me do this.
Here is the screenshot:
Try adding push segue(which is depreciated) and than change it to a show segue(between your tableviews). This is a workaround I use in my apps.
Ran into the same problem. Had a good fallback position, I am doing a tutorial that came with example programs completed and working so the first thing I did was see if it was a version glitch between 6.3.2 and 6.4. Turned out the earlier project worked just fine.
So what I did was simply drag the 'Item' in the sidebar and moved it under the Root View Controller!
I've experienced the same issue.
However, by saving and closing the project then reopening it, the Navigation Bar title is then able to be edited. Prior to closing/reopening the project the field could not be edited.
I've got a static table view as the main screen for my app right now, which is embedded in a container of the root view controller. the problem that i'm having is all of the items/pages that come from the original static table do not show a navigation bar in the storyboard. how to you recommend fixing this so I can use my UINavigationController in this container table. thank you.
Scenes in storyboard that do not come from a controller that has a navigation controller do not inherit the nav bar. To see what it looks like with a nav go to the scene in storyboard, then Attribute inspector from the right panel and change that controller to show a top bar instead of Inherit. This is useful when the code is adding the controller to the stack but there is no direct connection in storyboard from the controller to a navigation controller.
Now if your problem is that when you run the app app Segues from the static table push to controllers where there is no nav bar, this could be a result of embedding a tableViewController in a containerController. Maybe try setting a delegate on that TableViewController on the didSelectRow method and telling the Parent of the container to push.
I have seen a project with the following storyboard:
http://www.disclafani.org/vc.png
I would like to know how it has been built the CustomerPagesViewController as NavigationController, i don't see a RootNavigationController for it.
In short terms ... how can i define a UINavigationController that embeds a ViewController?
When you drag and drop a navigation controller in storyboard, it will create two controllers (two scenes to be more precise): a navigationbar controller and a tableview controller that will be defined as your rootview controller. All you have to do is replace your tableview controller by your custom controller: it will be embedded in your navigation controller.
EDIT
Sorry I think i mislead you in my first answer: it doesn't look like you can simply replace one controller by another. If you want a custom view controller embedded in a navigation controller a better approach would be:
Drag and drop a view controller on storyboard
Reference your custom view controller by editing the custom class field in the identity inspector
Drag and drop a navigation controller on storyboard
select your custom view controller and select from editor the embed in option by choosing navigation controller: your navigation controller should now contains your view controller. You can deleted the tableview controller that was created when you drag and drop the navigation bar controller.