Graphics Reference
In-Depth Information
Figure 3.2 The effect that rotating a view or layer has on its frame property
anchorPoint
As mentioned earlier, both the view's center property and the layer's position
property specify the location of the anchorPoint of the layer relative to its superlayer.
The anchorPoint property of a layer controls how the layer's frame is positioned
relative to its position property. You can think of the anchorPoint as being the
handle used to move the layer around.
By default, the anchorPoint is located in the center of the layer, so that the layer will be
centered around that position, wherever it might be. The anchorPoint is not exposed in
the UIView interface, which is why the view's position property is just called “center.”
But the anchorPoint of a layer can be moved. You could place it at the top left of the
layer frame , for example, so that the layer's contents would extend down and to the right
of its position (see Figure 3.3) instead of being centered on it.
Like the contentsRect and contentsCenter properties covered in Chapter 2, the
anchorPoint is specified in unit coordinates, meaning that its coordinates are relative to
the dimensions of the layer. The top-left corner of the layer is {0, 0}, and the bottom-right
 
Search WWH ::




Custom Search