swift - 麻烦 : 'PrincipalViewController' does not have a member named 'revealViewController' in swift

标签 swift sidebar menubar

我正在使用 Swift 中的 SWRevealViewController 创建侧边栏菜单。问题是我收到以下错误:“PrincipalViewController”没有名为“revealViewController”的成员

我正在处理的代码是:

class PrincipalViewController: UIViewController {
@IBOutlet weak var menuButton:UIBarButtonItem!

override func viewDidLoad() {
    super.viewDidLoad()

    // This is the line with the error
    if self.revealViewController() != nil {

        menuButton.target = self.revealViewController()
        menuButton.action = "revealToggle:"
        self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())

        // Uncomment to change the width of menu
        //self.revealViewController().rearViewRevealWidth = 62
    }

}

有什么想法吗?非常感谢

最佳答案

我刚刚发现了问题。应用程序中有 son objective-c 代码,桥接头没有配置好。非常感谢

关于swift - 麻烦 : 'PrincipalViewController' does not have a member named 'revealViewController' in swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28873068/

相关文章:

ios - 将 XCFramework 与 Objective-C 一起使用

wordpress - 古腾堡侧边栏中的日期时间选择器

javascript - 语义 UI 侧边栏组件在切换时不保留背景颜色

cocoa - 出现双状态项目图标

c# - 如何使 xamarin.ios 中生成的 gif 变慢?

ios - 如何为 Apple Mapkit 天桥制作动画?

ios - 对至少未渲染过一次的 View (_UIReplicantView) 进行快照需要 afterScreenUpdates :YES

html - 将侧边栏小部件很好地放置在彼此下方

python - 在 OS X 菜单栏中更改 Tkinter 应用程序的标题

python - 适用于任务栏 (Win) 和菜单栏 (mac) 功能的跨平台 Python GUI?