What are the differences between a UIView and a CALayer?

后端 未结 6 2191
天命终不由人
天命终不由人 2020-12-04 05:42

Both have most of the same attributes, both support different kind of animations, both represent different data. What are the differences between a UIView and a CALayer?

6条回答
  •  心在旅途
    2020-12-04 06:01

    From the Ray Wenderlich blog (Tutorial)

    CALayers are simply classes representing a rectangle on the screen with visual content. “But wait a darn minute,” you may say, “that’s what UIViews are for!” That’s true, but there’s a trick to that: every UIView contains a root layer that it draws to!

提交回复
热议问题