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.
精彩评论