Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing SWRevealViewConroller Library (slide out menu) in multiple storyboards

I am trying to implement SWRevealViewController Library as given in VideoTutorial, I was successfully able to do that but I don't want everything on 1 storyboard, I want to break it down in 2 storyboards

AppDelegate Code:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

    storyboard = UIStoryboard(name: "MenuDrawer", bundle: nil)           
    initialViewController = storyboard.instantiateViewControllerWithIdentifier("SWRevealViewController") as! UIViewController

    self.window?.rootViewController = initialViewController
    self.window?.makeKeyAndVisible()
    return true    
}

Rightnow MenuDrawer storyboard has everything

  1. SWRevealViewCOntroller
  2. TableViewController
  3. NavigationController
  4. RootViewController

and below segues which are defined in Library:

  1. segue1 (sw_rear) : between SWRevealViewController --> TableViewController
  2. segue2 (sw_front) : between SWRevealViewController --> NavigationController

now I want 3 and 4 in different storyboard. but when I move 3 and 4 to different storyboard how do I create segue 2 across storyboards

like image 795
T_C Avatar asked May 28 '15 04:05

T_C


3 Answers

I am not really sure if I understand your problem but you can try this to retrive your second storyboard and load your navigationViewController from there.

let storyBoard : UIStoryboard = UIStoryboard(name: "SecondStoryBoard", bundle:nil)

  let deleteViewController = storyBoard.instantiateViewControllerWithIdentifier("SecondNavigationController") as UINavigationController
like image 92
Icaro Avatar answered Nov 04 '22 05:11

Icaro


as far as iknow, you don't need to push again the segue 2 on 3 and 4. what you need is refer the new view (3 and 4) on the segue 2. in Obj-c will be like that:

UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
SWRevealViewController *view = [mainStoryboard instantiateViewControllerWithIdentifier:identifier];
[view setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[self.navigationController pushViewController:view animated:YES];

where "self" is the ViewController where segue 2 has been created. i hope have answered your question.

like image 1
Ostanik Avatar answered Nov 04 '22 07:11

Ostanik


Try This First Of All Make the other storyboard and add what you need then call the other storyboard in AppDelegate Code:

func application(application: UIApplication,didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

var storyboard = UIStoryboard(name: "MenuDrawer", bundle: nil)   
var storyboard1 = UIStoryboard(name: "NewStoryBoardName", bundle: nil)          
var initialViewController = storyboard.instantiateViewControllerWithIdentifier("SWRevealViewController") as! UIViewController
var initialViewController1 = storyboard1.instantiateViewControllerWithIdentifier("SWRevealViewController") as! UIViewController

self.window?.rootViewController = [initialViewController,initialViewController1]
self.window?.makeKeyAndVisible()
return true

}
like image 1
Irshad Qureshi Avatar answered Nov 04 '22 05:11

Irshad Qureshi