Swipeout Menu not working while using SWReveal Lib

2019-07-18 16:35发布

问题:

Toggle not working in swipeMenu...when using SWRevealViewController library.. ihave been following these tutorial

http://www.appcoda.com/sidebar-menu-swift/

Here is the project : https://drive.google.com/file/d/0B6dTvD1JbkgBUmJ3SmNYeFdvOHM/view?usp=sharing

回答1:

Hey i found the bug in your project the Left menu is not allocated,Try changing the Menu Controller and don't attach the segues for cell.Just Change the Menucontroller and try, it is working For cell segues you can call programmatically in tableviewdidselectrowatindexpath

here is link i have modified your code

https://drive.google.com/file/d/0B0pjD3FrutBsV3JiTDZ6aVAyWkE/view?usp=sharing

For eg:

 UINavigationController *navController = [self.storyboard instantiateViewControllerWithIdentifier:@"pager"];

  [self.revealViewController setFrontViewController:navController animated:YES];


回答2:

Try yhis

    var home = BrowseViewController(nibName: "HomeViewController", bundle: nil)
    var left = LeftMenuViewController(nibName: "LeftMenuViewController", bundle: nil)
    var nav1 = UINavigationController(rootViewController: home)

    var revel = SWRevealViewController(rearViewController: left, frontViewController: nav1)
    revel.delegate = self

    revel.modalTransitionStyle = UIModalTransitionStyle.FlipHorizontal
    window?.rootViewController = revel

Don't forget to set the delegate.

To toggle you can use

self.revealViewController().revealToggleAnimated(true)

and to push new ViewController

var nav = UINavigationController(rootViewController: vc!)
                self.revealViewController().pushFrontViewController(nav, animated: true)