是否可以将根 ViewController 包裹在另一个 ViewController 中?

Is it possible to wrap the rootViewController within another ViewController?

现在我正在尝试将 this library 与现有应用程序集成。但是,应用程序已经有一个 rootViewController。是否可以简单地将这个库需要的 frontView 重定向到应用程序拥有的当前 rootViewController?我需要实现的是在 rearViewController 和 frontViewController 之间滑动的能力,就像库给出的第一个例子一样。

只要让你的rootViewControllerclass继承自SWRevealViewController,那么你就不需要包装任何东西了。

阅读 Documentation 它解释了要做什么。你不需要包裹任何东西。

是的,但是您需要将 SWRevealController 设置为新的 rootViewController。

下面是一些示例代码,用于说明您的应用程序委托中的 application: didFinishLaunchingWithOptions:

MYAppViewController *mainVC = [[MYAppViewController alloc] init];

// Before using SWRevealViewController I had this line:
// self.window.rootViewController = mainVC

// Used for the rear view of the SWRevealViewController    
MYMenuViewController *menuVC = [[MYMenuViewController alloc] init];

SWRevealViewController *revealVC = [[SWRevealViewController alloc] initWithRearViewController:menuVC frontViewController:mainVC];

// Now set the SWRevealViewController as the root view controller
self.window.rootViewController = revealVC;