简体   繁体   中英

SWRevealViewController with StoryBoard with storyboard Identifier in Swift not segue how to do that

SWRevealViewController如何在swift中实现带有故事板标识符的故事板而不是segue请帮助我

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"StoryboardNibName" bundle:nil];
TempViewController *myVC = (TempViewController *)[storyboard instantiateViewControllerWithIdentifier:@"identifier"];
UIViewController *frontViewController = myVC;
RearViewController *rearViewController = [[RearViewController alloc] init];
UINavigationController *frontNavigationController = [[UINavigationController alloc] initWithRootViewController:frontViewController];
UINavigationController *rearNavigationController = [[UINavigationController alloc] initWithRootViewController:rearViewController];
SWRevealViewController *revealController = [[SWRevealViewController alloc] initWithRearViewController:rearNavigationController frontViewController:frontNavigationController];
revealController.delegate = self;
self.viewController = revealController;
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];

Swift:

 let storyboard = UIStoryboard(name: "Main", bundle: nil)
 let vc = storyboard.instantiateViewControllerWithIdentifier("TARGET_VIEW_CONTROLLER") as! UIViewController
 var rvc:SWRevealViewController = self.revealViewController() as SWRevealViewController
 rvc.pushFrontViewController(vc, animated: true)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM