我正在使用来自 this pod 的左侧菜单使用 Storyboard。 sidemenu 在 Swift 4.2 版 pod 中运行良好。但是我在这里更新了 Swift 5 中的 pod 我没有在属性检查器中得到这个菜单来打开左侧菜单,
在 Swift 5 pod 'SideMenu', '~> 6.0'
我从下方获得了完整菜单,但没有获得左侧菜单。
这就是我尝试在 appDelegate 中添加这段代码的原因:
let leftMenuNavigationController = SideMenuNavigationController(rootViewController: YourViewController)
SideMenuManager.default.leftMenuNavigationController = leftMenuNavigationController
但是这里我应该在YourViewController
地方写什么
在控制台中我得到如下所示:
Failed to set (leftSide) user defined inspected property on (UINavigationController): [ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key leftSide.
这是一个小型演示项目,您可以在此处找到 pod 安装和错误 github project
我需要这样的侧边菜单..我以前在 Swift 4 pod 中得到这样的菜单
如何在更新版本中添加左侧菜单?
最佳答案
我刚刚查看了您的项目。您创建的 segue 是一种“Present Modally”,只需将其更改为“Push”
Present Modally 就像呈现一个弹出窗口,因此它的默认动画是从下到上。
Push 有一个默认的从右到左的动画。
此外,您没有使用最新的 pod 版本。更新你的 pods 。
然后我从 SideMenuNavigationController 中删除类名并重新分配它。等待 Xcode 自行建议名称,然后按回车键。
最终结果
关于ios - 为什么侧面菜单 View 来自下方?如何使其成为左侧菜单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59508161/