I am drawing a simple rectangle with a few rounded corners:
UIBezierPath * p = [UIBezierPath bezierPathWithRoundedRect:outline
byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight
cornerRadii:CGSizeMake(8, 8)];
Oddly enough the top left hand corner seems incomplete - a small notch is missing:
Strangely enough - if add a [p close]
- that problem goes away. Now the documentation suggests that:
This method creates a closed subpath, proceeding in a clockwise direction (relative to the default coordinate system) as it creates the necessary line and curve segments.
so I am wondering where things go wrong ? Am I misunderstanding the documentation - or is there a subtle bug/issue in my code ?
For completeness the offending code is
- (void)drawRect:(CGRect)rect {
CGRect outline = CGRectInset(self.bounds, 4, 4);
UIBezierPath * p = [UIBezierPath bezierPathWithRoundedRect:outline
byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight
cornerRadii:CGSizeMake(8, 8)];
// [p closePath];
[[UIColor blackColor] setStroke];
[p setLineWidth:4];
[p stroke];
....