I. INTRODUCTION
1.CALayer is generally used as a container for UIView
2. is a layer architecture for managing picture vectors
3. Directly modify the created Calayer to trigger the hidden animation
4.UIView Calayer animation must show trigger
Two. Application
1. Modifying the layer of UIView is equivalent to modifying the UIView directly, for example
UIView *test = [[UIView alloc] initwithframe:cgrectmake (100, 100, 200, +)];test.layer.frame = CGRectMake Test.layer.backgroundColor = [Uicolor Redcolor]. Cgcolor; [Self.view Addsubview:test]; NSLog (@ "%f%f", Test.frame.size.width, Test.frame.size.height); The result is printed as a modified property value 200 200
2. Modify the created Calayer to trigger a hidden animation
- (void) viewdidload { [super viewdidload]; // Do any additional setup after loading the view, typically from a nib. // Creating a custom View uiview *contain = [[uiview alloc] initwithframe:cgrectmake (50, 50, 100, 4)]; contain.layer.borderWidth = 1; // Show Borders // custom layer, only the layer you create automatically creates animation effects _layer = [[CALayer Alloc] init]; _layer.frame = cgrectmake (0, 0, 0, 4); _layer.backgroundcolor = [uicolor redcolor]. cgcolor; // Join Layer [contain.layer addsublayer:_layer] ; [self.view addsubview:contaiChange action after n]; // 3 seconds [self Performselector: @selector (Changelayer) withobject:nil afterdelay:3.0f];} Modify properties to automatically trigger hidden animation- (void) changelayer { _layer.frame = CGRectMake (0, 0, 50, 4); // show Half}
IOS Calayer Use