嗨,我正在为我的iPad应用程序使用故事板.如何将SWRevealViewController添加到我的应用程序.我想将幻灯片视图添加到我的主视图控制器.任何人都可以建议我.我在AppDelegate.h中使用以下代码加载我的splitView
UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController; UINavigationController *navigationController = [splitViewController.viewControllers lastObject]; UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad" bundle:nil]; DetailViewController *rootViewController = [storyboard instantiateViewControllerWithIdentifier:@"CouponDetailRoot"];
解决方法
只需将Master View Controller作为SWRevealViewController的sw_front视图即可.然后,如果要折叠详细信息视图,以便首先只显示主视图,请创建这样的类并将其分配给故事板中的主视图控制器:
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 } }