Closed eldarkk closed 5 years ago
You can view an example on issue #59.
Embded the MainViewController in a navigation controller in AppDelegate.swift.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
let leftTableViewController = LeftTableViewController()
let navigationController = UINavigationController(rootViewController: leftTableViewController)
let rightTableViewController = LeftTableViewController()
let navigationController2 = UINavigationController(rootViewController: rightTableViewController)
let mainViewController = MainViewController()
let mainNC = UINavigationController(rootViewController: mainViewController)
let revealViewController = PBRevealViewController(leftViewController: navigationController, mainViewController: mainNC, rightViewController: navigationController2)
revealViewController.delegate = self
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window!.rootViewController = revealViewController
self.window!.makeKeyAndVisible()
return true
}
In MainViewController, In viewDidLoad function add a menuItem:
let menuItem = UIBarButtonItem(title: "Menu", style: .plain, target: self.revealViewController(), action: #selector(PBRevealViewController.revealLeftView))
self.navigationItem.leftBarButtonItem = menuItem
Thanks. Could you help. How can i programmatically show menuController by tapping on menu button? And how can i disable gestures? And how to remove blur effected navigation bar, because i init my own navigation bar in main controller. And i need to set width of menuController. Sorry Bro. I couldnt find it in documentation.
Like I have shown. For disable gestures, use PBRevealViewControllerDelegate:
For example:
func revealControllerPanGestureShouldBegin(_ revealController: PBRevealViewController, direction: PBRevealControllerPanDirection) -> Bool {
return false
}
For the width of your menuController, use:
/**
Defines the width of the left view when it is shown, default is 260.0f.
*/
open var leftViewRevealWidth: CGFloat = 260.0
For the blur effect, I don't understand what you mean.
The PBRevealViewController framework does not add any blur effects to any view unless requested.
On the left view if you set the leftViewBlurEffectStyle to anything else none (same on right view).
Not on Main view.
If you don't want any blur effect on your navigation bar, set its translucent property to false.
So I don't see.
Closing this issue, Feel free to re-open if needed.
How to show Menu controller like in 2nd example of main page in Github. I need to save "menu" button in navigation bar. Please help me! In answered questions i cant understand solution because i dont use storyboards at all.