• 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
Transparent Overlay Custom View
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Transparent Overlay Custom View


  • Subject: Transparent Overlay Custom View
  • From: Paul Thomas <email@hidden>
  • Date: Sat, 6 May 2006 11:29:44 +0100


I'm trying to implement a custom view that has a hierarchy of subviews and an overlay subview which is shown in certain states and has semi-transparent drawing in it. It's not working as the overlay view always appears opaque.


I've seen a couple of references to overlapping views not being supported - does that mean I can't make an overlay this way? If so, do I have to do something tricky with NSWindow overlays instead?

If views should work, maybe someone can see what I'm missing. My overlay looks a little like this:

@interface OverlayView : NSView
{
}
@end

@implementation OverlayView

- (id)initWithFrame:(NSRect)frameRect
{
    if ((self = [super initWithFrame:frameRect]) != nil) {
        // nothing special...
    }
    return self;
}

- (BOOL)isOpaque
{
    return YES;
}

- (void)drawRect:(NSRect)rect
{
    [[[NSColor lightGrayColor] colorWithAlphaComponent:0.5] set];
    NSRectFill([self bounds]);
}
@end

The parent view does nothing as yet except add and remove it:
[self addSubview: overlay_];
[overlay_ removeFromSuperview];


Thanks, Paul. _______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: Notification when change of superview (addSubView:)
  • Next by Date: Re: Transparent Overlay Custom View
  • Previous by thread: Cocoa-heads Lake Forest next week, 5/9, now with free stuff!
  • Next by thread: Re: Transparent Overlay Custom View
  • Index(es):
    • Date
    • Thread