What’s the relation between view and view.layer. For example, view.layer has property position. and view has property center. If I change the position of layer, does view change center property? If I change the bounds of view.layer, does view change its bounds property as well?
What’s the relation between view and view.layer. For example, view.layer has property position. and
Share
Views are backed by layers. As stackmonster says, a layer describes the low-level drawing context the system uses to render a rectangular area of content to the screen.
The other things stackmonster said about not manipulating layers directly, and poor animation performance, are flat-out wrong. Core Animation is based on layers. For many simple animations you can use UIView animation, but there are whole classes of animation and other things that require you to create and use layers directly. All CAAnimation objects act on layers, and there are lots of very cool tricks you can only do by manipulating layers directly. I use layers all the time for drawing and animation.
Layers and views use slightly different properties to control their position on the screen. As you say, a view has a center property and a layer has a position property. They are analogous.