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?
UIView
is a container for CALayers
. Using UIKit
.
CALayer
where we draw the contents. Using CoreGraphics
If you work with custom control like features it would be great to go ahead with single view containing more layers for accurate native rendering. Since CALayers
are weightless than UIView
.
To create common skeleton for Mac and iOS, follow the design for your app using CALayers
. Since it is available in both platform.
UIView
having feature like touch events achieved using delegates -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
, tochesStart
like events and other UIKit
features.
To work with CALayers
use Core Graphics knowledge.For any simple view rendering UIView
is enough.