I'm new to iOS, i am trying to develop a freehand drawing app, using uibezierPath
.is there a way to calculate or receive the total line length, even if i drew straight line, curved or a circle.
i am using addline on the the touchmove method, and i don't have any control points.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
- How do you detect key up / key down events from a
Inside your
touchesBegan
method, you can use this codeYou can call this method in any method to find the angle between two
CGPoints
in theUIView
.Hope this helped :-)
Irrespective of whether the line is curved or straight, you can find the distance between any two points. (I don't know how to get the length of the line). If the line is straight, the distance between the two points should be equal to that of the line.
Try this code,
It's a common method many are familiar with, (sqrt)[(x2-x1)(x2-x1) + (y2-y1)(y2-y1)].
Hope this helps :-)