Reputation: 224
I'm trying to replicate spotlight's view behaviour. Have added blurred adaptive background to NSWindow using:
NSVisualEffectView *visualEffectView = [[NSVisualEffectView alloc] initWithFrame:[self bounds]];
[visualEffectView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
visualEffectView.material = NSVisualEffectMaterialMediumLight;
visualEffectView.blendingMode = NSVisualEffectBlendingModeBehindWindow;
visualEffectView.wantsLayer = true;
visualEffectView.state = NSVisualEffectStateActive;
visualEffectView.layer.cornerRadius = 7.5;
[self addSubview:visualEffectView];
The problem is that background does work, but text and other elements inside the window don't adapt to the background below window correctly.
Here is the image.
.
Upvotes: 2
Views: 227