我正在使用 CosmicMaterial ( http://www.cosmicmind.io/material ) 来实现 Sidemenu 或抽屉菜单。我已经阅读了文档以及如何运行这个酷库的示例项目。我能够看到 CosmicMaterial 的 Sidemenu 演示。
一个问题是我很难弄清楚如何在 Sidemenu 中嵌入导航控制器。
我在 Appdelegate 中的代码 didFinishLaunchingWithOptions
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Get view controllers from storyboard
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let homeTableViewController = storyboard.instantiateViewControllerWithIdentifier("HomeTableViewController") as! HomeTableViewController
let sideViewController = storyboard.instantiateViewControllerWithIdentifier("SideTableViewController") as! SideTableViewController
// var navigationController = storyboard.instantiateViewControllerWithIdentifier("RootNavigationController") as! NavigationController
//
// var sideNavigationController = storyboard.instantiateViewControllerWithIdentifier("SideNavigationController") as! NavigationController
//
// navigationController = NavigationController(rootViewController: homeTableViewController)
// sideNavigationController = NavigationController(rootViewController: sideViewController)
//
//
// Configure the window with the SideNavigationController as the root view controller
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.rootViewController = SideNavigationController(rootViewController: homeTableViewController, leftViewController: sideViewController)
window?.makeKeyAndVisible()
return true
}
这是我在故事板中的布局。每个 xib 的所有 id 都已设置。