• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSVisualEffectView & NSVisualEffectBlendingModeBehindWindow & transparency
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSVisualEffectView & NSVisualEffectBlendingModeBehindWindow & transparency


  • Subject: NSVisualEffectView & NSVisualEffectBlendingModeBehindWindow & transparency
  • From: Jacek Oleksy <email@hidden>
  • Date: Fri, 26 Dec 2014 11:26:20 +0100

Hi,
I add vibrancy effect to my window using the following code:

In the view class:
- (void)awakeFromNib {
NSVisualEffectView* vibrantView = [[NSVisualEffectView alloc]
initWithFrame:self.frame];
vibrantView.appearance = [NSAppearance
appearanceNamed:NSAppearanceNameVibrantLight];
[vibrantView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
[self addSubview:vibrantView];
}

It uses default blending mode (which is
NSVisualEffectBlendingModeBehindWindow), and this is what I need.

Problem: the vibrancy effect goes right to the bottom of the desktop,
i.e. the color of desktop background color shines through (even if
there are some other windows in the way!).

The effect that I need is to have the transparency effect include only
the top visible window, this is how NSPopover works:

In view controller:
@interface PopoverController : NSViewController {
}
@end
@implementation PopoverController
- (void)loadView {
    self.view = [[NSView alloc] initWithFrame:NSMakeRect(10,10,100,100)];
}
@end
- (void) viewDidAppear {
    NSPopover* popover = [[NSPopover alloc] init];
    PopoverController* controller =[[PopoverController alloc] init];
    [popover setContentViewController:controller];
    [popover setBehavior:NSPopoverBehaviorTransient];
    [popover showRelativeToRect:self.view.bounds ofView:self.view
preferredEdge:NSMaxYEdge];
}

The popup that is created gets the vibrancy effect only from the
window that is right below it.

Any ideas on how to make it work for custom window?

Thanks,
Jacek
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Prev by Date: Re: Regenerating the dock image of a miniaturized NSWindow
  • Next by Date: Re: Regenerating the dock image of a miniaturized NSWindow
  • Previous by thread: Re: Regenerating the dock image of a miniaturized NSWindow
  • Next by thread: Beep ( frequency, duration)
  • Index(es):
    • Date
    • Thread