问题描述:

I want to dim the centercontroller view while drawer is open in MMDrawerController, and while drawer is closing progressively undim(increase alpha on subview?) the center controller.

网友答案:

Adding a dimming transperant view with alpha to centerviewcontroller inside visual state block gives this effect.

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()
    }
}
相关阅读:
Top