下载地址:
https://github.com/Inferis/ViewDeck
//创建中间的视图控制器
CenterViewController * centerVC = [[[CenterViewController alloc] init] autorelease];
UINavigationController * navVC = [[[UINavigationController alloc] initWithRootViewController:centerVC] autorelease];
//创建左菜单栏视图控制器
LeftViewController * leftVC = [[[LeftViewController alloc] init] autorelease];
//创建右菜单栏视图控制器
RightViewController * rightVC = [[[RightViewController alloc] init] autorelease];
//创建deckController
IIViewDeckController * deckController = [[[IIViewDeckController alloc] initWithCenterViewController:navVC leftViewController:leftVC rightViewController:rightVC] autorelease];
self.window.rootViewController = deckController;
完成上述程序后, 便可左右滑动, 若想通过一个按钮进入左右视图, 可关联下面的方法
//触发到左视图
[self.viewDeckController toggleLeftViewAnimated:YES]
从左视图返回时可用下面的方法更换中间的视图
[self.viewDeckController closeLeftViewBouncing:^(IIViewDeckController *controller) {
HotSearchViewController * hotSVC = [[[HotSearchViewController alloc] init] autorelease];
UINavigationController * navVC = (UINavigationController *) self.viewDeckController.centerController;
navVC.viewControllers = @[hotSVC];
}];