ios - 从侧边栏菜单隐藏 SWRevealViewController

标签 ios swift sidebar swrevealviewcontroller

我正在使用 SWRevealViewController 在我的应用程序中添加侧边栏菜单。它工作得很好,只要你触摸它的外部,它就会隐藏起来,但是,我希望能够在用户按下侧边栏菜单内部的 UIButton 时隐藏它。

知道怎么做吗?我假设我的 MenuViewController 中需要一个 IBOutlet,但我什至不知道我会用它做什么或如何让它隐藏菜单。

最佳答案

没关系,我已经解决了。我在我的 MenuViewController 中为退出按钮制作了一个 IBAction,我在里面放了:

self.revealViewController().revealToggle(animated: true)

关于ios - 从侧边栏菜单隐藏 SWRevealViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40776134/

相关文章:

ios - UIAlertController addTextFieldWithConfigurationHandler使用全局变量

ios - 如何使用浏览器重定向创建 Facebook 风格的应用内身份验证?

ios - Swift 单元测试 EXC_BAD_ACCESS(代码=1,地址=0x8)

ios - 以编程方式编码的 UIButton 未显示在我的 View 中

ios - CollectionView 中的自定义单元格重新排序行为

ios - 直到第二次加载时 View 才会更新

ios - 计算 Apple Watch 按下按钮时的百分比

GitLab 自定义 wiki 侧边栏不起作用

html - 如何根据内容 ID 对齐边栏元素

css - 重构 wordpress 侧边栏以并排放置备用小部件