ios - Get all vertices of a UIBezierPath -
i have uibezierpath made 6 vertices. want vertices uibezierpath. there possible way it?
you using cgpathapply
, cgpathapplierfunction
.
nsmutablearray *thepoints = [[nsmutablearray alloc] init]; uibezierpath *apath; cgpath thecgpath = apath.cgpath; cgpathapply(thecgpath, thepoints, mycgpathapplierfunc);
what pass on applier function each of path's elements. can list of points each element inside function , add them thepoints
.
your applier function like
void mycgpathapplierfunc (void *info, const cgpathelement *element) { nsmutablearray *thepoints = (nsmutablearray *)info; cgpoint *points = element->points; [thepoints addobject:[nsvalue valuewithcgpoint:points[0]]]; \\only 1 point assuming line \\curves may have more 1 point in points array. handle accordingly. }
Comments
Post a Comment