简体   繁体   中英

Swift 3 Implementing SideMenu control without Storyboard(hardcoded)

I'm trying to implement this control: Side Menu It say's that i need to instatiate it in the storyboard:

let menuLeftNavigation = Controllerstoryboard!.instantiateViewController(withIdentifier: "LeftMenuNavigationController") as! UISideMenuNavigationController

But I don't have a storyboard and I already created a UINavigationController (see below) So that I can use the module:

SideMenuManager.menuLeftNavigationController = menuLeftNavigationController

AppDelegate.swift

didFinishLaunchingWithOptions {
        let layout = UICollectionViewFlowLayout()
        let featuredVideosController = FeaturedVideosController(collectionViewLayout: layout)
        window?.rootViewController = UINavigationController(rootViewController:featuredVideosController) //Required

    }

I'm currently stucked here. Thanks for the help :)

In FeaturedVideosController 's viewDidLoad method, add:

let menuLeftNavigationController = UISideMenuNavigationController(rootViewController: YourMenuContentViewController)
menuLeftNavigationController.leftSide = true
SideMenuManager.menuLeftNavigationController = menuLeftNavigationController

Check more detail in Side Menu 's Code Implementation section.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM