ios - ENSideMenuNavController - Disable Interaction with All Other Views -


i have nav view when pops out tapping burger menu opens half page. still has other views (the root view controller , children) in background.

when user taps greyed out background area other views can interact views , page navigates leaving nav view on top.

the nav view used in multiple places need code disabling interactions other views in nav view controller. code below.

import uikit  class menunavviewcontroller: ensidemenunavigationcontroller, ensidemenudelegate {      var tabbar: managertabviewcontroller!      override func viewdidload() {         super.viewdidload()          let sb = uistoryboard(name: "iphonestoryboard", bundle: nil)         let menu = sb.instantiateviewcontroller(withidentifier: "menutableviewcontroller") as! menutableviewcontroller         menu.tabbar = self.tabbar         sidemenu = ensidemenu(sourceview: self.view, menuviewcontroller: menu, menuposition: .left)         sidemenu?.bouncingenabled = false          view.bringsubview(tofront: navigationbar)     }      override func didreceivememorywarning() {         super.didreceivememorywarning()         // dispose of resources can recreated.     }       // mark: - ensidemenu delegate     func sidemenuwillopen() {     }      func sidemenuwillclose() {     }      func sidemenudidclose() {      }      func sidemenudidopen() {      } } 

how can disable/enable interaction other views (or @ least view it's launched from) in navviewcontroller above?

i found answer shown in code below.

looking further ensidemenunavigationcontroller class found "init" method sets relevant view controllers on "viewcontrollers" , implemented code below gave desired effect.

import uikit  class menunavviewcontroller: ensidemenunavigationcontroller, ensidemenudelegate {      var tabbar: managertabviewcontroller!      override func viewdidload() {         super.viewdidload()          let sb = uistoryboard(name: "iphonestoryboard", bundle: nil)         let menu = sb.instantiateviewcontroller(withidentifier: "menutableviewcontroller") as! menutableviewcontroller         menu.tabbar = self.tabbar         sidemenu = ensidemenu(sourceview: self.view, menuviewcontroller: menu, menuposition: .left)         sidemenu?.bouncingenabled = false         sidemenu?.delegate = self           view.bringsubview(tofront: navigationbar)     }      override func didreceivememorywarning() {         super.didreceivememorywarning()         // dispose of resources can recreated.     }       // mark: - ensidemenu delegate     func sidemenuwillopen() {      }      func sidemenuwillclose() {     }      func sidemenudidclose() {         // enable interaction other views again         viewcontroller in self.viewcontrollers {             viewcontroller.view.isuserinteractionenabled = true         }     }      func sidemenudidopen() {         // disable interaction other views         viewcontroller in self.viewcontrollers {             viewcontroller.view.isuserinteractionenabled = false         }     } } 

any other suggestions better practice/code still appreciated.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -