Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

抽屉打开,中间视图部分有黑色半透明遮盖层?怎么实现? #501

Open
wenyanzhou opened this issue Oct 24, 2017 · 2 comments

Comments

@wenyanzhou
Copy link

MMDrawerController 实现左边侧滑出界面的时候,center VC 那部分需要 有一层 半透明灰色 遮盖,怎么整?

@subvin
Copy link

subvin commented Dec 11, 2017

我这边自己在 centerVC 加了一个遮罩,由dramerController setDrawerVisualStateBlock 回调的 percentVisible 进行控制遮罩的透明度,效果还不错。
[_drawerController setDrawerVisualStateBlock:^(MMDrawerController *drawerController, MMDrawerSide drawerSide, CGFloat percentVisible) {
MMDrawerControllerDrawerVisualState`Block block;
block = [[MMExampleDrawerVisualStateManager sharedManager]
drawerVisualStateBlockForDrawerSide:drawerSide];
if(block){

         block(drawerController, drawerSide, percentVisible);
     }
 }];

@zyj179638121
Copy link

[self.drawer setDrawerVisualStateBlock:^(MMDrawerController *drawerController, MMDrawerSide drawerSide, CGFloat percentVisible) {
MMDrawerControllerDrawerVisualStateBlock block;
block = [[MMExampleDrawerVisualStateManager sharedManager]
drawerVisualStateBlockForDrawerSide:drawerSide];
if(block){
block(drawerController, drawerSide, percentVisible);
}

    if (drawerController.openSide == MMDrawerSideNone && percentVisible == 1) {
        drawerController.centerViewController.view.alpha = 0.7;
        drawerController.centerViewController.navigationController.navigationBar.alpha = 0.7;
    }
    
    if (drawerController.openSide == MMDrawerSideLeft && percentVisible == 0) {
        drawerController.centerViewController.view.alpha = 1;
        drawerController.centerViewController.navigationController.navigationBar.alpha = 1;
    }
    
}];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants