<1>calayer Introduction
1, Calayer is generally used as a container for UIView.
2, Calayer is a manager picture carrier (image-based content) layer structure
3, directly modify the properties of the Calayer created by the individual can trigger an implicit animation
4. Calayer animation in UIView must be explicitly triggered to take effect
Opening code exercises:
1 #import "ViewController.h"2 3 @interfaceViewcontroller ()4 //2 Create a layer individually5@property (nonatomic,strong) Calayer *layer;6 7 @end8 9 @implementationViewcontrollerTen One- (void) Viewdidload { A [Super Viewdidload]; - //1 Creating a container view -UIView *containerview = [[UIView alloc] Initwithframe:cgrectmake ( -, $, -,3)]; theContainerview.backgroundcolor =[Uicolor Bluecolor]; - [Self.view Addsubview:containerview]; - //3 using and setting the relevant values for the layer -Self.layer =[Calayer layer]; +[Self.layer Setframe:cgrectmake (0,0, -,3)]; -Self.layer.backgroundColor = [Uicolor Redcolor]. Cgcolor;//don't forget to have another one at the end. Cgcolor + [Containerview.layer AddSublayer:self.layer]; A } at - - @end
< geek College > Video Tutorial Learning Notes-ios use of Calayer