开发者

Drawing a rounded rectangle with one side rounded [duplicate]

开发者 https://www.devze.com 2023-03-16 16:52 出处:网络
This question already has answers here: Closed 11 years ago. 开发者_开发技巧 Possible Duplicate: iOS Draw Rectagle with curved ends
This question already has answers here: Closed 11 years ago. 开发者_开发技巧

Possible Duplicate:

iOS Draw Rectagle with curved ends

In Objective-C (an iPhone app), how would I write a function which takes in a CGRect and draws a one-sided rounded rectangle. This is what a one sided rounded rectangle looks like:

ooooooooooooooo
o               o
o                 o
o                o
o               o
ooooooooooooooo

That drawing is hard to see, but basically, it's like a pencil, just not as pointy at the round side. I would like to use a combination of CGContext methods to do this. Can someone provide this code?


UIBezierPath provides a number of methods for constructing all sorts of paths. If that's not enough, CoreGraphics (aka Quartz) provides a complete set of path operations. Either of these solutions will be more than sufficient for drawing the path you've described.

0

精彩评论

暂无评论...
验证码 换一张
取 消