Transparent Overlay Custom View
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