微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

麻烦:’PrincipalViewController’在swift中没有名为’revealViewController’的成员

我正在使用 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
    }

}

有任何想法吗?非常感谢

从Cocoapods开始> 0.36,如果您使用Cocoapods将SWRevealViewController添加到您的项目中,请不要乱用桥接头.只需取消注释use_frameworks即可!在你的Podfile中.然后将SWRevealViewController导入ViewController.swift文件. Here’s a great article that explains it.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐