开发者

Drawing a rounded rectangle with one side rounded [duplicate]

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜