views:

128

answers:

1

I am looking to implement CATransitions within TTNavigator, I know the method openURL can take a UIViewAnimationTransition but that only gives me flipping and curling animations, but with CATransition I have access to another 8, of which kCATransitionFromRight, kCATransitionFromLeft, kCATransitionFromTop, kCATransitionFromBottom are the ones I am specifically after.

With a UINavigationController would use something like this piece of code to give me more control over the animation:

    CATransition *transition = [CATransition animation];
    transition.duration = 0.5f;
    transition.timingFunction = [CAMediaTimingFunction
    functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionPush;
    [self.navigationController.view.layer addAnimation:transition
    forKey:nil];

This code however, doesn't work with TTNavigator. Does anybody know how I can get my own custom animations to work with TTNavigator? Or if I am doing something wrong in my code?

+1  A: 

Turns out i answered my own question, but rather than using that last line of code to set the animation on the navigationController i was trying to set the transition to the URLAction. Once i put that line back in and commented out the URLAction transition code it seems to work!

    // create the URLAction
TTURLAction* urlAction;
urlAction = [TTURLAction actionWithURLPath:@"tt://Images"]; 
[urlAction applyAnimated:YES];

    // create the CATransition and set it to the navigation controller
CATransition *transition = [CATransition animation];
transition.duration = 0.5f;
transition.timingFunction = [CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
[self.navigationController.view.layer addAnimation:transition
forKey:nil]; 

    // tell the navigator to run the action
[[TTNavigator navigator] openURLAction:urlAction];

Hope this helps someone else in the future!

Bongeh