Recent projects require the development of a guided view of arrows, where the contents of the view are variable.
According to the product requirements, summed up some experience:
A product requirement:
1 arrows to the horizontal center of the graph to be pointed;
2 The boot view is fixed in size, but the position requirement varies according to the position being directed;
Second experience:
1 calculates the position of the entire graph according to the position pointed by the arrow;
Method of calculation:
A. Based on the calculation in the arrow play, the position of the incoming arrow is considered the center of the whole Arrow graph, and the x-axis minimum and maximum position (view_min_x,view_max_x) is calculated.
B. If view_min_x is greater than or equal to 8 and view_max_x is less than or equal to the screen width-8 uses the x-coordinate of the view_min_x as the Arrow Guide in a, and the position of the arrows in the entire arrow graphic in the play
C. If view_min_x is less than 8 and view_max_x is less than or equal to the screen width-8, use 8 as the x-coordinate of the arrow guide, and place the incoming arrow x-coordinate-8 as the arrow
D. If view_min_x is greater than or equal to 8 and view_max_x is greater than screen width-8, use the screen width -8.0f-arrow Guide width as the x-coordinate of the arrow guide, and the arrow x coordinate-8 as the position of the arrow
(8 is the left and right interval with 8 points)
2 Drawing Arrow Graphics uses Cashapelayer to draw arrow shapes, requires rounded corners, and notes the coordinates of the center point when drawing fillets
See below for three specific implementations:
Tips for IOS arrow type view