switch two view controller's view in a cube animation

the code below implement the switch between two view in a cube animation .

UIViewController* viewCtrl = [[UIViewController alloc] init:book];

CATransition *transition = [CATransition animation];
transition.duration = 1;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = @"cube";
transition.subtype = kCATransitionFromLeft;
transition.delegate = self;
[self.navigationController.view.layer addAnimation:transition forKey:nil];
self.navigationController.navigationBarHidden = NO;
[self.navigationController pushViewController:viewCtrl animated:YES];    

[viewCtrl release];

but, if the view don't belong to self.navigationController, how to do switch in cube animation between two view controller, and then how to scale the current view controller's view in the same time? thanks very much


This worked for me:

-(IBAction)animate:(id)sender {

    CATransition *transition = [CATransition animation];
    transition.delegate = self;
    transition.duration = 0.8;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    NSString *types[4] = {@"cube", @"rippleEffect", @"cube", @"alignedCube"};
    NSString *subtypes[4] = {kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromRight};

    transition.type = types[0];
    transition.subtype = subtypes[1];

    [self.view.layer addAnimation:transition forKey:nil];

    SecondView *_secondViewController = [[SecondView alloc]initWithNibName:@"secondView" bundle:nil];
    self.secondViewController = _secondViewController;
    _secondViewController = nil;

    [[[self view] layer] addAnimation: transition forKey: nil];
    [[self view] addSubview: [self.secondViewController view]];

-(void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag{
    [self.view release];

Need Your Help

Facing Issues with CSS Animation

css html5 css3 css-animations

I am trying to create a text that would fade into view after a few seconds but I am facing problems. The fade into view is working fine but the text disappears almost immediately after it is shown.

Inputs behaving unusually?

html ios css mobile mobile-safari

I am having alot of trouble putting my problem into words, and it would be much appreciated if someone could perhaps 'sum it up better'. Anyways, I'm styling a form to gather information, as it is

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.