Keeping a loaded View part of the tabController when the tableView cell is clicked? - ios

I have a tabbed application with a TableView in the FirstView. I want to be able click on a cell in the TableView and load a new view.
Right now, when the cell is clicked I go to the view I want but it isn't part of the tab bar controller (as in I I don't see the two tabs on the bottom) and I also can't get back to the FirstView where the TableView is located.
I have seen tutorials on this but they are all starting from scratch. I already have a lot of content on my FirstView so I don't want to start over.
I think I have to put in a Navigation Controller but I don't know how to do that without starting over and I also don't know where I would put it.
Here is the StoryBoard for my app:
http://i.imgur.com/2YJMMD5.png

I am not sure if I understood what you are trying to do but try to control click from your cell in the Home Table View Controller to your Friend View Controller, this will create a segue from the cell to the view controller so the view controller will be called once the cell is clicked.
Please let me know if this is what you are going for!

All you need to do is select your table view controller, go to the Editor menu, and choose "Embed in Navigation Controller". This will insert a navigation controller between the tab bar controller and your table view controller. Now when you select a cell, you should use a "show" segue to go (via a push) to your new view controller.

Related

Cannot move Navigation Bar above tableview Cell

I have added a table view controller that has a table view cell and when I try to add a navigation bar to the top. However when I try to add the navigation bar, it is not getting placed above the table view cell. I have tried it in both ways i.e. by trying to place it in the UI view (didn't work) and also in the Document Outline view (didn't work). Any suggestions on what I am doing wrong here? I have attached the screenshot for your reference.
Cheers.
From the outline view, make sure your Table View Controller is selected.
Then go to the Editor menu, and click on the Embed In submenu, and choose Navigation Controller. You have your navigation controller pointing to your tableview controller with a relationship built in.

How to make TabBarController inside another TabBarController in swift storyboard?

I wanna know how to create nested UITabBarControllers in Xcode, I'm using Swift.
My first UITabBarController has two items: Search (UITableView) and Map (MKMapView).
When I hit a cell in my table I wanna go to the second UITabBarController.
This second UITabBarController is the detail page for the clicked cell and must have three items --> Info, Reviews and Contact.
Can anyone explain how to do this? Right now I only have the first UITabBarController and a single view controller for the detail page working.
EDIT: The main problem is that when I nest the UITabBarControllers, my app always shows the items of the first UITabBarController.
Make another Tab View Controller next to it (You should see two tab view controllers on the storyboard), and then inside the Tab View Controller you want the other one in, insert a Container View. After the Container View is in the desired Tab View Controller and sized properly, hold control and drag from the Container View to the other Tab View Controller. After releasing, select embed and you should be good to go! Hope this helps. If it does, please vote this up :)
I found the answer by myself.
Just create a segue between the list view and the second tab controller.
And select on the second tab controller hide bottom bar on push in the attributes inspector.
Drag and drop new tabbarcontroller from stroryboard and from your list view controller ctrl+drag to this newtabbar controller and select show segue. (assuming that you are using navigation controller)

using my ViewController as a TabBarController

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.

How can I implement tab bar controller, navigation controller and table view controller?

I'm looking to create an application with 4 screens. The first screen will have a tab bar controller with two tabs. The second tab will go to 3rd screen. The 3rd screen will be a table view and when a cell is clicked, will push to the 4th screen and then I want to have a back button on 4th screen to navigate back to 3rd screen. The first screen will have a button that segues to the second screen and from the second screen there is a button that segues to 3rd screen which is the table view. The second screen should also have a back button to go back to first screen. How can I implement this via StoryBoard?
There are a lot of tutorials in the Apple developer site... but also on youtube... search for "Storyboard ios" you can find a step by step tutorial on how to manage the tableview controller and additional tableview to show details. I suggest also to look at http://www.raywenderlich.com/
What I understand so far from your question. You should first drag a Tab bar controller, that will by default have 2 tabs. Now on 1st tab or 1st view controller, place a button and make its push relation with the view controller you want. 2nd tab will open 3rd screen. Place a table view in it(view controller with 2nd tab or item). Make push relation from table view cell to the 4th screen(drag view controller and embed this view with navigation Controller). Embed all those views with navigation controller form where you want to turn back to previous view controller. Hope this is what you wanted.
I have figured out my issue. I wasn't using push to segue with my navigation controller and that was throwing everything off. Thanks for the help!

How to create a UIView with NavigationBar and TabBar

I would like to introduce in my app a View that will contains both navigation bar and a tab bar at the bottom. View contains a Table View with multiple entries and once user tap on a cell a push segue takes him to another view with details regarding the cell he has previously tapped. If he decides, user can go back to parent view by tapping on 'Back' button of the navigation bar on top. In addition to this, I would like my view to have a tab bar at the bottom with extra tools for the user. So, if he decides to check the 'Creator' of the app, he can by simply tap on 'Creator' TabBarItem at the bottom.
I would like to ask you what is the best way to achieve the above. I have already tried to use UITabBarController combined with UINavigationController. Didn't achieve what I was looking for because I would like the view with the table on it to be independent from the TabBarController and NOT a part of it (by part I mean by accessible through tabs).
Do you believe a UINavigationController view with UITabBarView would be a better choice?
UPDATE
What I mean by, "independent from the TabBarController and NOT a part of it":
Once the app loaded, I would like to see my main view (with table) contains Navigation Bar on top and Tab Bar at the bottom. However, I don't want to see the first tab of the Tab Bar selected because my main view will not be accessible through tabs of the Tab Bar but through Navigation Bar. If, for example, I am in Main view and tap on 1st tap, I would like to move to another view that will contains some other info.
Option 1:-
Create a tab bar Controller and on that TabbarController assign your navigation Views.
say nav1 with tab1 , nav2 with tab2...
Option 2:-
Create a Navigation View Controller and than add the tabbarcontroller on that navigationView Controller by using addSubView.
So when the user clicks on a row in a table u will go to a different View which doesn't have the TabbarController and when the user comes back he will again see the TabbarController.
This is what I will do:
First I will subclass UITabbarController and create for example ParentTabBarController. This controller will contain all the tabs necessary and what they will do if they are clicked so on.
Next for each viewcontroller I create, I will subclass from this ParentTabBarController so that the tabs are already in. You can add additional functionality or override it depending on your situation.
In your appdelegate pass in a navigation controller and every time push and dismiss the viewcontrollers you created in second step.
Hope this helps..

Resources