Re: Rounded rect overlap in collection view
Re: Rounded rect overlap in collection view
- Subject: Re: Rounded rect overlap in collection view
- From: Graham Cox <email@hidden>
- Date: Sun, 1 Nov 2009 10:03:41 +1100
On 01/11/2009, at 8:17 AM, PCWiz wrote:
I tried drawing a rect around the whole frame like so:
- (void)drawRect:(NSRect)dirtyRect
{
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:[self
frame] xRadius:6.0 yRadius:6.0];
[[NSColor whiteColor] set];
[path stroke];
[super drawRect:dirtyRect];
}
..and I get the same result
You're flailing. The scattergun approach never works for coding. Look
up the right documentation: "Cocoa Drawing Guide", and also the
supporting documentation for NSView.
1. the <dirtyRect> passed is exactly what it implies.
2. the rect you need to be drawing is [self bounds] which is the
locally adjusted frame rectangle. Note that [self frame] is typically
(but not always) the same size but has a different location. If you
are programming with views you definitely need to know the difference.
3. There's no need to call [super drawRect] as it doesn't do anything
(unless this is a sub-subclass of NSView and you know different).
--Graham
_______________________________________________
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