加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

麻烦:’PrincipalViewController’在swift中没有名为’revealVi

发布时间:2020-12-14 02:26:51 所属栏目:百科 来源:网络整理
导读:我正在使用 Swift中的SWRevealViewController创建侧边栏菜单.麻烦的是我收到以下错误:’PrincipalViewController’没有名为’revealViewController’的成员 我正在处理的代码是: class PrincipalViewController: UIViewController {@IBOutlet weak var men
我正在使用 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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读