SWRevealViewController from the right side on swift

前端 未结 6 2197
梦毁少年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条回答
  •  无人共我
    2021-02-20 06:10

     *override func viewDidLoad() {
      super.viewDidLoad()
    .
    .
    .
     menuButton.addTarget(revealViewController(), action: #selector(SWRevealViewController.rightRevealToggle(_:)), for: .touchUpInside)
      if revealViewController() != nil {
       revealViewController().rightViewRevealWidth = 200 //any number
       view.addGestureRecognizer(self.revealViewController().panGestureRecognizer()
       view.addGestureRecognizer(self.revealViewController().tapGestureRecognizer())
            }
        }
    }
    

    in the main story board add a segue of type "custom" from SWRevealViewController to ur sideMenuViewController then select the segue and in the inspector set its identifier to sw_right and class to SWRevealViewControllerSegueSetController that's all.**

提交回复
热议问题