当前位置: 动力学知识库 > 问答 > 编程问答 >

ios - How to dim CenterController on Side menu open in mmdrawercontroller?

问题描述:

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()
    }
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: