Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SWRevealViewController - push view controller from side menu

I've set up my app using the SWRevealViewController and it's working fine but I want to change how it works. At the moment I have the following views on the same level:

  • Home
  • View A
  • View B

But I want:

  • Home
    • View A
    • View B

I still want Home, View A, View B to be in the menu but when clicking on View A or View B it gets pushed onto Home. And in the navigation bar it has a back button instead of the menu button.

Is this possible using SWRevealViewController?

like image 693
GMon Avatar asked Mar 16 '23 16:03

GMon


1 Answers

in objective-C

UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
SWRevealViewController *main = (SWRevealViewController *)[mainStoryboard instantiateViewControllerWithIdentifier:@"SWRevealViewController"];
[self presentViewController:main animated:YES completion:nil];

in swift -- it automatically open the your root view controller of SWL

let storyboard = UIStoryboard(name: "Main", bundle: nil)
let main = storyboard.instantiateViewControllerWithIdentifier("SWRevealViewController") as! UIViewController //SWRevealViewController
self.presentViewController(main, animated: true, completion: nil)
like image 100
Anbu.Karthik Avatar answered Mar 22 '23 23:03

Anbu.Karthik