-
Notifications
You must be signed in to change notification settings - Fork 333
Usage
If you want for a side menu be available through the entire app, then the recommended way is to make UINavigationController
the root view controller for LGSideMenuController
:
let navigationController = UINavigationController(rootViewController: UIViewController())
let sideMenuController = LGSideMenuController(rootViewController: navigationController)
This way, when you open side view, the whole UINavigationController
, including its UINavigationBar
will be hidden.
If you want for a side menu be available only on one screen, then it makes sense to push LGSideMenuController
as one of UINavigationController
's child view controllers:
let sideMenuController = LGSideMenuController(rootViewController: UIViewController())
let navigationController = UINavigationController(rootViewController: sideMenuController)
This way, when you open side view, only root view of UINavigationController
will be changed, which means UINavigationBar
will stay on the same place.
Logic is the same as with UINavigationController
.
If you want for a side menu be available through the entire app, then the recommended way is to make UITabBarController
the root view controller for LGSideMenuController
:
let tabBarController = UITabBarController()
tabBarController.setViewControllers([UIViewController(), UIViewController()], animated: false])
let sideMenuController = LGSideMenuController(rootViewController: tabBarController)
This way, when you open side view, the whole UITabBarController
, including its UITabBar
will be hidden. And for each tab side view will be the same view.
If you want for a side menu be available only on one tab, or you want to have different side views for each tab, then it makes sense to set LGSideMenuController
as one of UITabBarController
's child view controllers:
let sideMenuController1 = LGSideMenuController(rootViewController: UIViewController())
let sideMenuController2 = LGSideMenuController(rootViewController: UIViewController())
let tabBarController = UITabBarController()
tabBarController.setViewControllers([sideMenuController1, sideMenuController2], animated: false])
This way, when you open side view, only opened tab of UITabBarController
will be changed, which means UITabBar
will stay on the same place. And for each tab side view will be a different view.