3

I am trying to use a SWrevealViewController for sidemenu . One of the options on it is "User Profile" . Since I access user's profile from various other views , I would like to have to have a push segue to this VC. However , a push segue is not working from SWRevealViewController to UserProfileVC.

Can anyone suggest how I may use a push sugue from SWRevealVC?

jordanhill123
  • 4,142
  • 2
  • 31
  • 40
Rhiya
  • 271
  • 6
  • 21

3 Answers3

5

Here's my solution:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil]
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"YOUR_VC_STORYBOARD_ID"];

SWRevealViewControllerSeguePushController *segue = [[SWRevealViewControllerSeguePushController alloc] initWithIdentifier:@"ANY_ID" source:self destination:vc];
[segue perform];
Atrox111
  • 527
  • 4
  • 17
4

Swift version will be

let vc = self.storyboard?.instantiateViewControllerWithIdentifier("LoginRoot") as! UINavigationController
let  segue = SWRevealViewControllerSeguePushController.init(identifier: SWSegueRearIdentifier, source: self, destination: vc)
segue.perform()

Navigation controller is UIViewcontroller. i used navigation controller otherwise use UIViewController object.

Avijit Nagare
  • 8,482
  • 7
  • 39
  • 68
0

Create a custom segue from your Reveal View Controller to your side menu view controller using the storyboard editor. Set the identifier as "sw_rear", kind as "Custom" and class as "SWRevealViewControllerSegueSetController".

With this, if you create ordinary "push" segues from your menu view controller to other view controllers they should be pushed normally.

Felipe Ferri
  • 3,488
  • 2
  • 33
  • 48