John-Lluch / SWRevealViewController

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !
Other
4.52k stars 989 forks source link

Parent ViewController == nil #755

Open ghost opened 6 years ago

ghost commented 6 years ago

i have leftside menu in my project . i had given "sw-rear "to my leftmenuVC . After clicking my menubutton i am getting ParentVC as nil.

    navigationItem.leftBarButtonItem = UIBarButtonItem(image: UIImage(named:"ic_menu"), style: UIBarButtonItemStyle.plain, target: self, action: #selector(menuButtonPressed))

@objc func menuButtonPressed()
    {
        if revealViewController() != nil{
            self.navigationItem.leftBarButtonItem?.target = self.revealViewController()
            self.navigationItem.leftBarButtonItem?.action = #selector(SWRevealViewController.revealToggle(_:))
            self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
        }

}

iDevelopper commented 6 years ago

It is not sw-rear but sw_rear

ghost commented 6 years ago

by mistake i type here like that but in project i mentioned correct.

ghost commented 6 years ago
screen shot 2017-11-13 at 3 22 01 pm
iDevelopper commented 6 years ago

What is ParentVC?

ghost commented 6 years ago

the parent should Come as SWRevealViewController

ghost commented 6 years ago
screen shot 2017-11-13 at 3 26 53 pm
ghost commented 6 years ago

Main.storyboard.zip

This is my storyBoard. Can check and let me know the mistake that i did

iDevelopper commented 6 years ago

I can't see a sw_front segue in your storyboard, how do you set the front view controller? SWRevealViewController should be the initial controller and ActivitiesVC the front view controller...