我想在MMDrawerController中打开抽屉时以及在抽屉逐渐关闭时(在子视图中增加alpha值)中央控制器使centercontroller视图变暗。
最佳答案
在视觉状态块内的中央viewcontroller中添加带有alpha的变暗透明视图可达到此效果。
let drawerController = DrawerController(centerViewController: nav, leftDrawerViewController: SideMenuTableViewController())
let blurView = UIView(frame: UIScreen.mainScreen().bounds)
blurView.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.4)
drawerController.drawerVisualStateBlock = { (drawer, drawerSide, percentVisible) in
if percentVisible > 0 && blurView.superview == nil {
drawerController.centerViewController?.view.addSubview(blurView)
}
if percentVisible == 0 {
blurView.removeFromSuperview()
}
}
关于ios - 如何在mmdrawercontroller中打开侧面菜单上的CenterController变暗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31603077/