开发者

get info about a CGpath, UIBezierPath?

I have a series of paths, mostly straight lines, or almost straight lines. I'd like to categorize them as horizontal, vertical, diagonal, and also the direction in which they are drawn (up->down, down->up, left->right, right->left etc). some of the lines are L shaped, and I'd like that info too.

this can probably be done if i knew the endpoints of the path, but i don't know how to extract that info. Also, I need more than that for L shaped lines since the endpoints would indicate a diagonal. I've looked on all the reference pages, and can't find that sort of info. so, 开发者_开发技巧if you know that, or another way to get the information i'm looking for ... thanks


The only way you can access the underlying structure is using the CGPathApply method on it. You pass a C function that is passed each of the elements(CGPathElement) in the bezier path. You should be able to discern what type of line it is in that method.

There is a good example on using CGPathApply. It's not exactly what you need but looks like a good starting point.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜