Avijit Nagare
Avijit Nagare

Reputation: 8782

Simple Push (view controller) from menu in SWRevealViewController in Swift?

This is my SWRevealViewController Menu look like.

enter image description here

When i select "reveal view controller push controller" or "reveal view controller set controller"

i am getting login screen with SWRevealViewController menu (not back button) as this image which correct.

enter image description here

For this i used code

      if self.revealViewController() != nil {

            menuButton.target = self.revealViewController()
            menuButton.action = "revealToggle:"
            menuButton.title = ""
             menuButton.image = UIImage(named: "reveal-icon")

            self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())

   }

Problem: Now i want simple push from SWRevealViewController menu. i don't want "reveal view controller push controller" and use above code.

To pop view controller I tried.

self.navigationController.popViewController(animated:false) // not working 

Just need simple push. and after back button press it should back to Home or Menu.thanks in advance.

simple push i should get "Back icon" as shown in below.enter image description here

Upvotes: 2

Views: 3296

Answers (1)

Mr. Bond
Mr. Bond

Reputation: 427

Did you try to make the reveal view controller the entry point of your app and deleting the launch controller, because if you just want to go back to the main view you could just do this as follows:

let storyboard = UIStoryboard(name: "Main", bundle: nil)
    let controller = storyboard.instantiateInitialViewController() as UIViewController!
    self.presentViewController(controller, animated: false, completion: nil)

Upvotes: 3

Related Questions