Fred Novack
Fred Novack

Reputation: 811

How to load another View Controller on Tabbed application Without losing the tab

I have a Tab Bar application coded in Objective-c. One of the tabviews I have is a TableView. What I'm trying to do is, when a cell of this TableView is selected, the app takes the user to another view, but this view isn't on the tab menu, and I don't want to lose the tab menu when this view appears.

Is it possible to do it? How? Couldn't find much on the web.

Upvotes: 0

Views: 635

Answers (2)

Suhas Arvind Patil
Suhas Arvind Patil

Reputation: 1750

If you are having the single View Controller to show then you can try doing this by adding the new view controller's view as subView to the current view controller's view

Eg:

newVC.view.frame = self.view.frame;
newVC.view.frame.size.height = self.view.frame.size.height - HEIGHT_OF_TAB_BAR;
[self.view addSubview:newVC.view];

If there are more View Controller's that are adding further then using the navigation controller under tab bar controller will also work.

Refer: How to implement tab bar controller with navigation controller in right way

Upvotes: 0

Ketan Parmar
Ketan Parmar

Reputation: 27438

Just embed navigation controller to that tab's viewcontroller which have tableview.

so your viewhierarchy should be like tabbar controller - navigation controller - viewcontroller (tab) - detailviewcontroller

you can embed navigation controller by selecting viewcontroller, then from menu select editor then embed in then navigation controller.

Hope this will help :)

Upvotes: 1

Related Questions