Linkon Sid
Linkon Sid

Reputation: 531

SWRevealViewController with TabbarController set as rootViewController

I'm gonna use SWRevealViewController to create sidebar menu. In my storyboard the rootviewcontroller is a tabbar controller that was pushed from a navigation controller. Here is my storyboard design: enter image description here

I need to add a viewcontroller as SWRevealViewController to implement sidebar menu. How can I achieve that? I'm using swift for my project.Any help would be really appreciable. Thanks.

Upvotes: 2

Views: 962

Answers (2)

karthik
karthik

Reputation: 621

i had the same problem. user https://github.com/dekatotoro/SlideMenuControllerSwift.git. Use this library. which is written in swift.Here is the flow. Have one RootNavigation Controller -> MenuviewController. create your sideviewcontroller and Tabbar controller. push these two from menuviewcontroller. which will work fine.Put this in menuview controller

    super.viewDidLoad()

    SlideMenuOptions.contentViewOpacity = 0.3
    SlideMenuOptions.contentViewScale = 1
    SlideMenuOptions.animationDuration = 0.3
    SlideMenuOptions.hideStatusBar = false

    SlideMenuOptions.leftViewWidth = (self.view.bounds.size.width * 80) / 100

    //self.mainViewController = self.storyboard!.instantiateViewControllerWithIdentifier(StoryBoardViewControllerIdentifier.NavigationController) as? UIViewController

    self.mainViewController = self.storyboard?.instantiateViewControllerWithIdentifier(StoryBoardViewControllerIdentifier.TabBarController) as! TabBarController
    self.rightViewController =  self.storyboard?.instantiateViewControllerWithIdentifier(StoryBoardViewControllerIdentifier.RightSideMenuVC) as! RightSideMenuCtrl

    self.initView()
}

Upvotes: 1

Linkon Sid
Linkon Sid

Reputation: 531

I manage to solve this by following design: enter image description here

Set SWRevealViewController as rootviewcontroller. Then connect it to the navigation controller with segue identifier "sw_front".

Upvotes: 1

Related Questions