7

Hi I am using storyboard for my iPad app. How can I add SWRevealViewController to my app. I want to add slide view to my master view controller. Can any body please suggest me. I am loading my splitView using the following code in AppDelegate.h

    UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;
    UINavigationController *navigationController = [splitViewController.viewControllers lastObject];
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad" bundle:nil];
    DetailViewController *rootViewController = [storyboard instantiateViewControllerWithIdentifier:@"CouponDetailRoot"];

enter image description here

Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143
gundra
  • 93
  • 5

1 Answers1

0

Just make the Master View Controller the sw_front view of the SWRevealViewController. Then, if you want the detail view to be collapsed so only the master view shows up at first, create a class like this and assign it to the Master View Controller in storyboard:

    import UIKit

class GlobalSplitViewController: UISplitViewController, UISplitViewControllerDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()

        self.delegate = self
    }

    func splitViewController(_ splitViewController: UISplitViewController, collapseSecondary secondaryViewController:UIViewController, onto primaryViewController:UIViewController) -> Bool {
        return true
    }

}
fullmoon
  • 8,030
  • 5
  • 43
  • 58