Open BasmaElias opened 8 years ago
Otherwise, #603
viewController displayed normally but self.revealViewController() equal nil and the menu button doesn't work
Have you configured in your storyboard the controller to the class RevealViewController?
yes , when i run app self.revealViewController() equal value then if i press menu button and go the any viewcontroller self.revealViewController() be nil
The code :
self.revealViewController().revealToggleAnimated(true) if let secondViewController = self.storyboard?.instantiateViewControllerWithIdentifier("ProtectedPageViewController") as? ProtectedPageViewController { let navController = UINavigationController(rootViewController: secondViewController) navController.setViewControllers([secondViewController], animated:true) self.revealViewController().setFrontViewController(navController,animated:true) }
if i delete self.revealViewController().revealToggleAnimated(true) , button will be work but the viewcontroller will not display normally
You have just to set a target and an action for this button:
class ViewController1: UIViewController {
@IBOutlet weak var menuButton: UIBarButtonItem!
override func viewDidLoad() {
super.viewDidLoad()
menuButton.target = revealViewController()
menuButton.action = #selector(SWRevealViewController.revealToggle(_:))
}
Thank you 😃 , its working now
i have a left menu and the front view controller display normally when the app run but if i open the menu and choose any item the top part of the UIViewController doesn't display normally .. if i rotate the device and return it the top part of UIViewController be normal ..
and it is my code
if let secondViewController = self.storyboard?.instantiateViewControllerWithIdentifier("ProtectedPageViewController") as? ProtectedPageViewController { let navController = UINavigationController(rootViewController: secondViewController) navController.setViewControllers([secondViewController], animated:true) self.revealViewController().setFrontViewController(navController,animated:true) self.revealViewController().setFrontViewPosition(.Left, animated: true) }