0

So Ive implemented the SWRevealViewController in my app, with much success so far.

A challenge I have now is that I want to accomodate a different Menu based on a different user profile type.

Currently I am able to push a new 'frontViewController' to my 'self.revealViewController' which shows a different main screen, but when I tap the menu button, is reveals the original menu (as sort of expected).

Is it possible to programtically change which menu view controller I want to reveal when I push the new front view controller?

Is it even possible to have a scenario like this using SWRevealViewController? (ie. having 2 different 'rear' views depending on which front view you are using?)

Thanks!

Simon
  • 2,065
  • 3
  • 21
  • 28
  • Create object of `SWReavelController` which is prefer as depend on user, in rear view controller. Now change target of menu button and this will point to menu which you like. – Kampai Nov 27 '15 at 10:10

1 Answers1

0

Yes, this is perfectly possible with SWRevealViewController to change the rear view controller while it is running.

You'll want to maintain a reference to each view controller that you want to show such as

var myFirstViewController: UIViewController?
var mySecondViewController: UIViewController?

When you want to change them, set the rearViewController property on your SWRevealViewController as in

myRevealViewController.rearViewController = myFirstViewController!

or

myRevealViewController.rearViewController = mySecondViewController!
Daniel Zhang
  • 5,778
  • 2
  • 23
  • 28