【发布时间】:2016-07-09 16:20:03
【问题描述】:
我正在使用 SWRevealViewController 在 Swift 2.0 中显示侧边菜单我已经从 GitHub 下载了文件,创建了桥接头并正确连接了 segue。我正在创建一个自定义按钮,但“显示切换”操作没有触发。我在哪里做错了?
super.viewDidLoad()
self.navigationController?.navigationBar.topItem?.title = "DASHBOARD"
self.navigationController!.navigationBar.tintColor = UIColor.whiteColor()
self.navigationController!.navigationBar.titleTextAttributes =
[NSForegroundColorAttributeName: UIColor.whiteColor()]
self.navigationController!.navigationBar.titleTextAttributes = [ NSFontAttributeName: UIFont(name: "Teko-Regular", size: 26)!]
self.navigationController?.navigationBar.barTintColor = UIColor.redColor()
let btnName = UIButton()
btnName.setImage(UIImage(named: "LeftNavItem"), forState: .Normal)
btnName.frame = CGRectMake(0, 0, 20, 20)
let leftBarButton = UIBarButtonItem()
leftBarButton.customView = btnName
self.navigationItem.leftBarButtonItem = leftBarButton
if self.revealViewController() != nil {
//print(self.revealViewController())
leftBarButton.target = self.revealViewController()
leftBarButton.action = Selector("revealToggle:")
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
}
手势识别器正常触发,但“revealToggle:”不正确,这是什么错误?
【问题讨论】:
标签: ios swift swrevealviewcontroller