I need to draw a line with an arrow head. How can i do this using Core graphics. Any help!!!
+3
A:
- Draw a line.
- Draw a triangle at the end of it.
Yes, that is, in fact, the only way. (Well, unless somebody has released some source code that does that for you. If not, maybe you'll be the one to do so? ☺)
Peter Hosey
2009-10-01 06:30:09
Ok. To draw triangle at the end,one side of my triangle must be perpendicular to my line. How i get that perpendicular line .
diana
2009-10-01 06:46:44
Don't worry about that. Draw your triangle in a constant orientation. Use trigonometry to work out the angle of the line, then rotate the current transformation matrix by a corresponding angle before drawing the triangle.
Peter Hosey
2009-10-01 06:52:39
You can even draw the triangle only once into a CGMutablePath, with its origin at 0,0, then translate the CTM before rotating it to get the triangle into the correct position. (This is a bit trickier, though.)
Peter Hosey
2009-10-01 06:53:48
Ok.Thank u very much..Let me try.
diana
2009-10-01 06:59:36