Tôi đang làm việc để tạo trình đơn thanh bên bằng cách sử dụng SWRevealViewController trong Swift. Rắc rối là tôi nhận được lỗi sau: 'PrincipalViewController' không có một thành viên có tên là 'revealViewController'Sự cố: 'PrincipalViewController' không có thành viên có tên 'revealViewController' trong swift
Code tôi đang làm việc trên là:
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
}
}
Bất kỳ ý tưởng? Cảm ơn rất nhiều
'self.revealViewController()' là gì? –
Tôi nghĩ là bộ điều khiển xem cho thanh bên. Nhưng tôi đã thực hiện tìm kiếm trong ứng dụng demo đang hoạt động và không có tham chiếu đến chế độ xem đó –
Đây là trang web tôi đã tải xuống mã (http://www.appcoda.com/sidebar-menu-swift/) –