我想在抽屉在MMDrawerController中打开时调暗中央控制器视图,而抽屉在逐渐关闭时(在子视图上增加alpha?)中央控制器。
答案 0 :(得分:2)
在视觉状态块中添加带有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()
}
}