- (void)CATransition{
//轉(zhuǎn)場(chǎng)代碼必須得要和轉(zhuǎn)場(chǎng)動(dòng)畫(huà)在同一個(gè)方法當(dāng)中.
//創(chuàng)建動(dòng)畫(huà)
CATransition *anim = [CATransition animation];
anim.type = @"push";
anim.duration = 1;
[self.imageV.layer addAnimation:anim forKey:nil];
[self performSelector:@selector(nextAnimition) withObject:self afterDelay:2];
//轉(zhuǎn)場(chǎng)代碼
_i++;
if (_i > 3) {
_i = 1;
}
NSString *imageName = [NSString stringWithFormat:@"%d",_i];
self.imageV.image = [UIImage imageNamed:imageName];
}
- (void)nextAnimition
{
CATransition *anim = [CATransition animation];
//設(shè)置轉(zhuǎn)場(chǎng)類(lèi)型
anim.type = @"rippleEffect";
//設(shè)置轉(zhuǎn)場(chǎng)的方向
anim.subtype = kCATransitionFromBottom;
//設(shè)置動(dòng)畫(huà)的開(kāi)始點(diǎn).
anim.startProgress = 0.2;
//設(shè)置動(dòng)畫(huà)的結(jié)束點(diǎn).
anim.endProgress = 0.8;
anim.duration = 1;
[self.imageV.layer addAnimation:anim forKey:nil];
}
-
anim.type
屏幕快照 2017-01-20 下午3.30.06.png
