0

我只是想在不是 rootview 的单独视图控制器上显示浮动菜单?通常我只是将它添加到 rootview 控制器。

让 menuController = AppMenuController(rootViewController: toolbarController)

    let navigationController  = AppNavigationDrawerController(rootViewController: menuController, leftViewController: leftViewController,rightViewController: rightViewController)
    let statusController = AppStatusBarController(rootViewController: navigationController)

    window = UIWindow(frame: Screen.bounds)

    window!.rootViewController = statusController

    window!.makeKeyAndVisible()
4

2 回答 2

0

让 main: MainViewController = { return UIStoryboard.viewController(identifier: "MainViewController") as!主视图控制器}()

让 newView = AppMenuController(rootViewController: main)

self.present(allergyView,动画:假,完成:无)

于 2017-01-12T12:17:22.313 回答
0

添加Menu作为 UIViewController 的属性。例如:

class ViewController: UIViewController {
    fileprivate let menu = Menu()
    fileprivate let baseSize = CGSize(width: 64, height: 64)

    open override func viewDidLoad() {
        super.viewDidLoad() {
        prepareMenu()
    }
}

extension MenuController {
    fileprivate func prepareMenu() {
        menu.zPosition = 1000
        menu.baseSize = baseSize

        view.layout(menu)
            .size(baseSize)
            .bottom(24)
            .right(24)
     }
}

如果您不想将 Material 控制器与根视图控制器一起使用,您应该能够查看这些控制器中的设置代码,以查看添加它们管理的组件所需的代码,例如 MenuController。

一切顺利 :)

于 2017-01-12T17:23:43.317 回答