How to Create UITabController on a Button Click

59 Views Asked by At

I am working on app. It has normal 3 views. On third view, I have a table view. If I select any row, I want a view which contains UITabController. I have created a simple UITabController app, but unable to do this. How to do this ?

thanks in advance

2

There are 2 best solutions below

0
On

IMHO, your question is perhaps ill conceived.

A tab bar controller controls view controllers which in turn control views. Your suggestion that a view contains a controller of controller simply does not make sense.

Maybe what you really want on selecting a row in your table view is to present a new view controller and then make the (existing) tab bar visible.

0
On

You usually want a UITabBar to be THE navigation for your application and not show it later on one view.

But if you want to do so you should show, as Mundi said, a new UITabBarViewController when you select your UITableViewCell.

I don't know your exact usecase, but if you work with a UITableView I would use a UINavigationController to push a new View when you tap one UITableViewCell. Then it may be better (If you have 2-3 Elements) to use a UISegmentedControl in the UINavigationBar. This would look like this.