- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
//添加轉場動畫
CATransition *anim = [CATransition animation];
anim.duration = 1;
//設置轉場類型
//@"cube" @"moveIn" @"reveal" @"fade"(default) @"pageCurl" @"pageUnCurl" @"suckEffect" @"rippleEffect" @"oglFlip"
anim.type = @"oglFlip";
anim.subtype = @"fromRight";
[self.imageV.layer addAnimation:anim forKey:@"kCTransitionAnimation"];
//轉場代碼 跟轉場動畫必須得要在同一個方法當中
_i++;
if (_i > 3) {
_i = 1;
}
NSString *imageName = [NSString stringWithFormat:@"%d",_i];
self.imageV.image = [UIImage imageNamed:imageName];
// UIView *view = [[UIView alloc]init];
// [view.layer addAnimation:anim forKey:nil];
// self.imageV.backgroundColor = [UIColor colorWithRed:arc4random_uniform(255)/255.0 green:arc4random_uniform(255)/255.0 blue:arc4random_uniform(255)/255.0 alpha:1];
}