0
votes

i'm creating an application in which i'm using SWReveal for side menu and its front view is a tab bar which contains three tabs. Whenever i open any tab from the side menu it shows tab bar at bottom, i have also other view controllers in my side menu. Now when i open the other view controller that are not attached to the tab bar they didn't get tab bar at their bottom. How can restrict my application that my three tabs should be shown to the other view controllers also. Whenever i open any other view controller from the side menu it should show the tab bar there also. How this can be done in swift?

1
You could connect navigation controllers to each tab bar item and then when an option is selected from the side menu, you could push the proper viewcontroller to the navigationcontroller of any tab you want. - bseh
My other view controller does not have tab bar at their bottom. How it would show there tab bar when i push my other view controllers? @bseh - Awais
if you connect a navigationcontroller to a tabbarcontroller, any viewcontroller pushed to that navigation controller stack will have that tabbaritem unless you set hidesBottomBarWhenPushed to true - bseh
my other view controllers are not in the stack of navigation controller of tab bar they are place seperate in the storyboard. @bseh - Awais
still, you could instantiate them with a storyboard id and add them to the current stack. otherwise you would have to use the tab bar as a custom view and handle all the actions yourself. - bseh

1 Answers

0
votes

Instantiate the view controller you want to push to the current stack:

let storyboard = UIStoryboard(name: "yourStoryboardName", bundle: nil)
let viewController = storyboard.instantiateViewControllerWithIdentifier("yourViewControllersStoryboardId") as UIViewController //and the class name of the view controller that you want to push
self.navigationController?.pushViewController(viewController!, animated: true)//the navigation controller of the tab item you want to push view controller to

Yes, it will show the back button.