views:

533

answers:

1

Hey guys,

I'm almost done coding my project and I have come across 1 to 2 problems with the fading. Here is what my code looks like

CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionFade];
[animation setSubtype:kCATransitionFromRight, kCATransitionFromLeft];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];

It's telling me to set a subtype. I basically want to animate going back and going forward. I know i'm pretty close. What else am i missing from the code?

+2  A: 

As near as I can tell -setSubtype: takes one NSString* argument.

The line:

[animation setSubtype:kCATransitionFromRight, kCATransitionFromLeft];

should probably be either:

[animation setSubtype:kCATransitionFromRight];

or:

[animation setSubtype:kCATransitionFromLeft];

EDIT: You may also want to add:

[[myView layer] addAnimation:animation forKey:@"transitionFromRight"];

to begin animating your myView object (which is a UIView or subclass).

Alex Reynolds
Awesome! So it's not asking my about the subtype anymore but now that i build and go it does not show any transitions.
Dane