Rhiya
Rhiya

Reputation: 271

SWRevealViewController push Segue

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?

Upvotes: 3

Views: 2147

Answers (3)

Avijit Nagare
Avijit Nagare

Reputation: 8802

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.

Upvotes: 4

Felipe Ferri
Felipe Ferri

Reputation: 3588

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.

Upvotes: 0

Atrox111
Atrox111

Reputation: 527

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];

Upvotes: 5

Related Questions