0

我试图弄清楚如何在 Material 的菜单中引入第二列,但我发现使用相同的 View Controller 的菜单委托方法控制两个很棘手。可能有一种我没有想到的简单方法来实现这一点?我可以让另一个视图控制器成为第二个菜单的代表,但这似乎不是一个优雅的解决方案。

干杯!

4

1 回答 1

0

If you are using the Menu object itself, and not the MenuController, you should be able to do a compare in the delegation method, where you compare the menu being called with your view controller declaration property for either Menu. For example:

extension ViewController: MenuDelegate {
    func menu(menu: Menu, tappedAt point: CGPoint, isOutside: Bool) {

        if menu == menuA {

        } else if menu == menuB {

        }
    }
}

Now you should only need to do this if the functionality differs for each columns menu. If you need any further help, please share you code :)

于 2017-02-07T20:24:10.000 回答