About anchorPoint and anchorpoint
The anchorPoint attribute is CGPoint (x, y), and the value of x and y is proportional. Generally, the value ranges from 0 ~ 1. The default value is (0.5, 0.5), indicating the position of the layer in its own position. For example,
After the size and position of the red view are determined, if you modify the anchorPoint of the layer, the center position of the red view is offset. At this time, the positioning point is at the place pointed by the arrow, the value of anchorPoint is () in the upper left corner of the layer, and () in the lower right corner. The center of the layer is changed because of the change of anchorPoint. For details about anchorPoint, refer to the upper left corner () and lower right corner) in this example, anchorPoint = (0.5, 1), the view will move up the height of the 0.5 layers. At this time, anchorPoint is in the position of the arrow,
AnchorPoint is essentially a point, but when the View frame is determined first, it changes the center point of the layer. The anchorPoint value depends on the layer,
In this question, if you write v first. layer. anchorPoint, and then write v. frame, the center of the view remains unchanged, but the coordinates of the positioning point have changed, because the positioning point cannot change the center point of the layer when the layer position does not exist.