SWRevealViewController from the right side on swift

前端 未结 6 2259
梦毁少年i
梦毁少年i 2021-02-20 05:28

I am using SWRevealViewController library to make a slide out menu in swift, but I am struggling to put this menu in the right side. I have seen on the library description this

6条回答
  •  萌比男神i
    2021-02-20 06:20

    I followed this solution, in the controller of the front siding view use this:

    override func viewDidLoad() {
        super.viewDidLoad()
    
        if self.revealViewController() != nil {
            favoritesButton.target = self.revealViewController()
            favoritesButton.action = "rightRevealToggle:"
            self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
        }
    }
    

    Don't forget to create the Outlet to the item bar button first. In the storyboard, set the segue value to sw_right

    And first that didn't work for me, but a clean helped.

提交回复
热议问题