ios - Implicit animation on CALayer "contents" property -


according core animation documentation, setting layer contents should trigger implicit 0.25 animation transition between new , old images. see many places people asking how remove implicit animation reason when try on project, instant swap of images. reading more documention saw code snipped:

- (id<caaction>)actionforlayer:(calayer *)thelayer                         forkey:(nsstring *)thekey {     catransition *theanimation=nil;      if ([thekey isequaltostring:@"contents"]) {          theanimation = [[catransition alloc] init];         theanimation.duration = 1.0;         theanimation.timingfunction = [camediatimingfunction functionwithname:kcamediatimingfunctioneasein];         theanimation.type = kcatransitionpush;         theanimation.subtype = kcatransitionfromright;     }     return theanimation; } 

which implies "contents" not implicitly animated.

i interested understand better.

ok, i'm copying code app of mine. first catransition not alloc..init.. using +animation. second i'm not seeing adding transition layer. third i'm not sure catransition implicitly animated, calayer properties yes.

catransition *transition = [catransition animation];     transition.duration = 1;     transition.timingfunction = [camediatimingfunction functionwithname:kcamediatimingfunctioneaseineaseout];     transition.type = kcatransitionpush;     transition.subtype = slidecatransitioncomparetable[ arc4random() % 4]; //to random subtype      [self.slideshowreceiptimageview.layer addanimation:transition forkey:nil]; 

Comments