ios - 为什么侧面菜单 View 来自下方?如何使其成为左侧菜单?

标签 ios swift swift5 side-menu

我正在使用来自 this pod 的左侧菜单使用 Storyboard。 sidemenu 在 Swift 4.2 版 pod 中运行良好。但是我在这里更新了 Swift 5 中的 pod 我没有在属性检查器中得到这个菜单来打开左侧菜单,

enter image description here

在 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 中得到这样的菜单

enter image description here

如何在更新版本中添加左侧菜单?

最佳答案

我刚刚查看了您的项目。您创建的 segue 是一种“Present Modally”,只需将其更改为“Push”

Present Modally 就像呈现一个弹出窗口,因此它的默认动画是从下到上。

Push 有一个默认的从右到左的动画。

enter image description here

此外,您没有使用最新的 pod 版本。更新你的 pods 。

enter image description here

然后我从 SideMenuNavigationController 中删除类名并重新分配它。等待 Xcode 自行建议名称,然后按回车键。

enter image description here

最终结果

enter image description here

关于ios - 为什么侧面菜单 View 来自下方?如何使其成为左侧菜单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59508161/

相关文章:

ios - 当表在 ScrollView 内时编辑 UITableviewCell 不起作用

ios - 如何在collectionView中嵌入一些具有不同数据的tableView?

ios - 在没有 Segues 的 ViewController 之间传递数据

ios - 对符合 Swift 协议(protocol)的对象和变量进行单元测试

ios - 本地化字符串仅通过 Interface Builder 应用翻译

ios - 使用自动布局创建对齐表单

javascript - 为什么 Click 事件不适用于 iOS 上的 li 元素?

iOS segue.destinationViewController 不发送信息

ios - 使用 FBSDKMessenger 打开特定用户的 facebook Messenger

swift - 使用 YouTube API 标签创建字符串数组