0

Is it possible to dim the super viewController but not any of its childViewControllers. For example, dim my map view but not the tableviewController that is its childViewController.

enter image description here

PopoverViewControllers wont work because I'm on iPhone only. What is my best solution to this problem?

NojDavid
  • 89
  • 1
  • 10
  • Add a view on superviewcontroller with transparent background. – Mukesh Jan 16 '18 at 05:58
  • You can use popover view controller in iPhone same as iPad from IOS8. https://stackoverflow.com/questions/16230700/display-uiviewcontroller-as-popup-in-iphone – Bilal Jan 16 '18 at 06:04

1 Answers1

0

You can add a view(e.g. blackMaskView) above mapView with:

self.mapview.insertSubview(blackMaskView, aboveSubview: self.mapview)

and then add a blur effect to blackMaskView as follows:

func createBlurView() {

    // Blur Background

    let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.dark)

    let blurEffectView = UIVisualEffectView(effect: blurEffect)

    blurEffectView.frame = self.view.bounds

    self.blackMaskView.addSubview(blurEffectView)

    self.view.layoutIfNeeded()

}  

Use blackMaskView.isHidden = true, to finally hide the blurred view. Please mark the answer correct if you find it useful.

Sam
  • 521
  • 1
  • 6
  • 23