[英]Swift 3 Implementing SideMenu control without Storyboard(hardcoded)
我正在嘗試實現此控件: 側面菜單它說我需要在情節提要中對其進行實例化:
let menuLeftNavigation = Controllerstoryboard!.instantiateViewController(withIdentifier: "LeftMenuNavigationController") as! UISideMenuNavigationController
但是我沒有情節提要,我已經創建了一個UINavigationController(請參見下文),以便可以使用該模塊:
SideMenuManager.menuLeftNavigationController = menuLeftNavigationController
AppDelegate.swift
didFinishLaunchingWithOptions {
let layout = UICollectionViewFlowLayout()
let featuredVideosController = FeaturedVideosController(collectionViewLayout: layout)
window?.rootViewController = UINavigationController(rootViewController:featuredVideosController) //Required
}
我目前被困在這里。 謝謝您的幫助 :)
在FeaturedVideosController
的viewDidLoad
方法中,添加:
let menuLeftNavigationController = UISideMenuNavigationController(rootViewController: YourMenuContentViewController)
menuLeftNavigationController.leftSide = true
SideMenuManager.menuLeftNavigationController = menuLeftNavigationController
在側邊菜單的代碼實現部分中查看更多詳細信息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.