pushViewController
一連の画像を使用したアニメーションのカスタムアニメーションを作成したいと思います。
私はこれを私がcurrentViewController
望む画像で覆われるところまで行ってきましたnextViewController
が、アニメーション画像の順序を逆にしようとしたときに明らかにすることができるかどうかわかりません。
これまでのところ私は以下を持っています
- (IBAction)nextAction:(id)sender {
UIImage* img1 = [UIImage imageNamed:@"image-1.png"];
UIImage* img2 = [UIImage imageNamed:@"image-2.png"];
UIImage* img3 = [UIImage imageNamed:@"image-3.png"];
UIImage* img4 = [UIImage imageNamed:@"image-4.png"];
UIImage* img5 = [UIImage imageNamed:@"image-5.png"];
NSArray *animationImages = [NSArray arrayWithObjects:img1,img2,img3,img4,img5,nil];
CALayer *myLayer = [CALayer layer];
myLayer.bounds = CGRectMake(0.0, 0.0, 320.0, 480.0);
myLayer.position = self.view.center; //CGPointMake(0.0 ,0.0);
CAKeyframeAnimation *animationSequence = [CAKeyframeAnimation animationWithKeyPath: @"contents"];
animationSequence.calculationMode = kCAAnimationLinear;
animationSequence.autoreverses = NO;
animationSequence.duration = 0.4;
animationSequence.delegate = self;
animationSequence.repeatCount = 1; //HUGE_VALF;
NSMutableArray *animationSequenceArray = [[NSMutableArray alloc] init];
for (UIImage *image in animationImages)
{
[animationSequenceArray addObject:(id)image.CGImage];
}
animationSequence.values = animationSequenceArray;
[myLayer addAnimation:animationSequence forKey:@"contents"];
[self.view.layer addSublayer:myLayer];
}
- (void)animationDidStop:(CAAnimation*)animation finished:(BOOL)finished {
NextViewController *nextViewController;
nextViewController = [[NextViewController alloc] initWithNibName:@"NextViewController" bundle:nil];
nextViewController.title = @"next";
[self.navigationController pushViewController:nextViewController animated:NO];
[nextViewController release];
}
これIBAction
nextAction
は、ユーザーがボタンを押すと実行され、画像は現在のビューの上にアニメーション化されます。
私が達成したいのは、画像が上に表示された後、画像のnextViewController
下を押してアニメーションを反転し、画像が表示されるようにnextViewController
することです。
これが理にかなっていることを願っています。写真を持っているのと同じように、写真の上にいくつかのカードを置き、カードを取り除くと別の写真が表示されます。
テオ