- with
[myLayer setName:@"layer_1"]
I set the name of a layer. But how can I get it from another method? Is there s开发者_如何学Goomething like[self.view.layer.sublayers getLayerByName:@"layer_1"]
? - how to animate a
CALayer
to move it to another position with a nice smooth effect?
The name
property is primarily intended for use by some layout managers, except layout managers don't exist on iOS, so all it's really useful for at this point is debugging.
As for animation, if you're using a CALayer you created yourself, you'll get implicit animations when you change properties. You can set explicit animations using the CAAnimation subclasses, and you can also tweak some parameters of the implicit ones with CATransaction.
If you're using a layer that's associated with a UIView
, all implicit animations are disabled. You can still create explicit ones with the CAAnimation
subclasses, or you can use the UIView animation methods.
精彩评论