Removing Shadow from NSView
Removing Shadow from NSView
- Subject: Removing Shadow from NSView
- From: Jeremy Sacket <email@hidden>
- Date: Fri, 22 Jul 2005 14:50:17 -0500
I have a class ShadowView that subclasses NSView. I have -(void)
drawDropShadowForObject:(id)object and pass in the control (object) I
want the shadow to be behind. It works perfect. However, I can not
seem to remove the shadow unless I resize the window.
Here is what I have tried.
1. Call [[self superview] display]
2. Move the ShadowView off of the window
3. Set the shadowView to hide.
My question is were does the actual shadow reside? It seems to me
that the shadow is not attached to the NSView the calls the [NSShadow
set].
Any ideas or suggestions?
Here is my method to draw the shadow:
-(void)drawDropShadowForObject:(id)object
{
NSPoint p = [self convertPoint:[object bounds].origin
fromView:object];
NSRect rect = NSMakeRect(p.x,p.y-[object bounds].size.height,
[object bounds].size.width,[object bounds].size.height);
NSBezierPath *myPath = [NSBezierPath bezierPathWithRect:rect];
[self allocateGState];
NSShadow *shadow = [[NSShadow alloc] init];
[shadow setShadowBlurRadius: 10];
[shadow setShadowOffset: NSMakeSize (0, -5)];
[shadow setShadowColor:[NSColor colorWithCalibratedRed:0
green:0 blue:0 alpha:.5]];
[shadow set];
[[NSColor blackColor] set];
[myPath stroke];
[[NSColor whiteColor] set];
[myPath fill];
[self releaseGState];
}
Thanks,
Jeremy
_______________________________________________
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