Reputation: 9545
I created a bezier path with:
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect
byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight)
cornerRadii:CGSizeMake(10, 10)];
Is there a way to only stroke 3 of the 4 sides?
Upvotes: 2
Views: 507
Reputation: 8513
Yes, by creating your own bezier path. Here's how we did this back in the days. You can apply/stroke this path using a CoreGraphics context. Should be easy enough. I've adapted the sample to draw a rounded rect without the bottom part.
CGFloat width = 100;
CGFloat height = 200;
CGFloat radius = 10;
CGMutablePathRef path = CGPathCreateMutable ();
CGPathMoveToPoint (path, nil, width, 0);
CGPathAddLineToPoint (path, nil, width, height - radius);
CGPathAddArcToPoint (path, nil, width, height, width - radius, height, radius);
CGPathAddLineToPoint (path, nil, radius, height);
CGPathAddArcToPoint (path, nil, 0, height, 0, height - radius, radius);
CGPathAddLineToPoint (path, nil, 0, 0);
CGPathCloseSubpath (path);
Upvotes: 2