objective-cmacoscocoaxcode6nsvisualeffectview

Xcode 6 Don't Apply Vibrant Effect to Child View


Good evening, everyone!

Is it possible to apply the "vibrant" visual effect to a parent view, without a child view inheriting it?

My main window has the vibrant effect applied to the entire view, but when using a popover segue to display a new view, that view is also transparent. Is there any way to prevent this?

Thanks!


Solution

  • You can set the popover view's window appearance in the controller's viewWillAppear():

    Swift

    override func viewWillAppear() {
        self.view.window?.appearance = NSAppearance(named: NSAppearanceNameVibrantDark)
    }
    

    Obj-C

    - (void)viewWillAppear {
      self.view.window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameVibrantDark];
    }