JVillella / JVFloatingDrawer

An easy to use floating drawer view controller.
MIT License
1.41k stars 158 forks source link

Tabbar Controller as center view #17

Closed rupaksp closed 7 years ago

rupaksp commented 9 years ago

Hi,

Is it possible to add TabbarController as center view ?

IbrahimYildirim commented 9 years ago

Yes it is, in the. Here is an example (in Swift). You just set the centerViewController to be equal to the TabBar Controller

//JV Floating Navigation Drawer
var drawerViewController : JVFloatingDrawerViewController?
var drawerAnimator : JVFloatingDrawerSpringAnimator?
var leftDrawerViewController : UIViewController?

//Drawer View Controllers
var projectsViewController : UINavigationController?
var profileTabBarController : UITabBarController?

func setupDrawerNavController() {
    self.drawerViewController?.leftViewController = getLeftDrawerViewController()
    self.drawerViewController?.centerViewController = getProfileTabBarController()

    self.drawerViewController?.animator = getDrawerAnimator()
    self.drawerViewController?.backgroundImage = UIImage(named: "NavigationBackground")
}

//MARK: Setup ViewControllers
func getLeftDrawerViewController() -> UIViewController {
    if leftDrawerViewController == nil {
        leftDrawerViewController = NavigationDrawerController()
    }
    return leftDrawerViewController!
}

func getProfileTabBarController() -> UITabBarController {
    if profileTabBarController == nil {
        self.profileTabBarController = ProfileTabBarController()
    }
    return profileTabBarController!
}