mmdrawercontroller:ide
1、滑動手勢開關抽屜:spa
初始化中心視圖it
初始化左/右視圖:LeftDrawerTableViewController * leftTVC = [[LeftDrawerTableViewController alloc] init];
UINavigationController * leftNC = [[UINavigationController alloc] initWithRootViewController:leftTVC];io
初始化抽屜視圖控制器(可設置抽屜寬度):MMDrawerController * drawerController = [[MMDrawerController alloc] initWithCenterViewController:CenterNC leftDrawerViewController:leftNC];方法
完成滑動: //滑動手勢快關抽屜
[drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
[drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];
self.window.rootViewController = drawerController;im
2、按鈕點擊抽屜:margin
抽屜按鈕實現方法:animate
//抽屜按鈕動做
-(void)leftDrawerButtonPress:(id)sender
{
//開關左抽屜
[self.mm_drawerController toggleDrawerSide:MMDrawerSideLeft animated:YES completion:nil];
}di
viewdeck:view
1、滑動手勢開關抽屜:
1.建立中心視圖
CenterViewController *centerView = [[CenterViewController alloc] initWithNibName:@"CenterViewController" bundle:nil];
2. 建立左/右視圖
LeftViewController *leftView = [[LeftViewController alloc] initWithNibName:@"LeftViewController" bundle:nil]; RightViewController *rightView = [[RightViewController alloc] initWithNibName:@"RightViewController" bundle:nil];
3.初始化viewdeck
self.deckController = [[IIViewDeckController alloc]initWithCenterViewController:centerView leftViewController:leftView rightViewController:rightView];
self.window.rootViewController = self.deckController;
2、按鈕點擊抽屜:
- (void)toLeft {
[self.deckController toggleLeftViewAnimated:YES];
}