before adding a layer to your view using [self.layer addSublayer:yourCALayer] and also after it has already been added, you can disable certain animated properties of your CALayer by overwriting the animation key. The key that you set to NULL is named after the property, it shows how it is done for layer.position = CGPoint(x,y);
yourCALayer.actions = [NSDictionary dictionaryWithObject:[NSNull null] forKey:@"position"];
Since the actions property is an NSDictionary that doesnβt allow nil to be stored, you set it explicitly for the NULL object using [NSNull null] , which is the same as (id)kCFNull You can do this for all sublevels by iterating over all sublevels of the viewing layer with. ..
for (CALayer *iterationLayer in self.layer.sublayers ) { iterationLayer.actions = [NSDictionary dictionaryWithObject:[NSNull null] forKey:@"position"]; //or for multiple keys at once NSNull *nop = [NSNull null]; iterationLayer.actions = [NSDictionary dictionaryWithObjects:@[nop,nop] forKeys:@[@"position",@"contents"]]; }
Ol Sen 01 Oct '18 at 6:24 2018-10-01 06:24
source share