• 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
Re: Rounded rect overlap in collection view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Rounded rect overlap in collection view (From: PCWiz <email@hidden>)
 >Re: Rounded rect overlap in collection view (From: Kyle Sluder <email@hidden>)
 >Re: Rounded rect overlap in collection view (From: PCWiz <email@hidden>)

  • Prev by Date: Asynchronous downloading again
  • Next by Date: Re: Seemingly Documentation confusion?
  • Previous by thread: Re: Rounded rect overlap in collection view
  • Next by thread: Asynchronous downloading again
  • Index(es):
    • Date
    • Thread