抽屉效果----mmdrawercontroller和viewdeck

mmdrawercontroller:

一、滑动手势开关抽屉:

  1. 初始化中心视图

  2. 初始化左/右视图:LeftDrawerTableViewController * leftTVC = [[LeftDrawerTableViewController alloc] init];
        UINavigationController * leftNC = [[UINavigationController alloc] initWithRootViewController:leftTVC];

  3. 初始化抽屉视图控制器(可设置抽屉宽度):MMDrawerController * drawerController = [[MMDrawerController alloc] initWithCenterViewController:CenterNC leftDrawerViewController:leftNC];

  4. 完成滑动: //滑动手势快关抽屉
        [drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
        [drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];

        self.window.rootViewController = drawerController;

二、按钮点击抽屉:

抽屉按钮实现方法:

//抽屉按钮动作
-(void)leftDrawerButtonPress:(id)sender
{
    //开关左抽屉
    [self.mm_drawerController toggleDrawerSide:MMDrawerSideLeft animated:YES completion:nil];
}


viewdeck:

一、滑动手势开关抽屉:

    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;  

二、按钮点击抽屉:

- (void)toLeft {  

    [self.deckController toggleLeftViewAnimated:YES];  

}  


你可能感兴趣的:(抽屉效果----mmdrawercontroller和viewdeck)