PDA

View Full Version : Undocumented Animation Transitions!




Darkroom
Dec 12, 2009, 02:17 AM
am i the only person who didn't know about this?


#define NextPage 101
#define PreviousPage 102
#define Suck 103
#define WaterRipple 110
//There are a few others also (105, 106, 107, proabably more)

@implementation TransitionEffectsViewController

- (void)viewDidLoad
{
UIImageView *transitionView = [[UIImageView alloc] initWithFrame:CGRectMake(50, 100, 200, 300)];
transitionView.image = [UIImage imageNamed:@"parot2.jpg"];
transitionView.tag = 88;
[self.view addSubview:transitionView];
[transitionView release];

UIButton *transitionButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[transitionButton addTarget:self action:@selector(animation) forControlEvents:UIControlEventTouchUpInside];
[transitionButton setTitle:@"Show Transition" forState:UIControlStateNormal];
[transitionButton setFrame:CGRectMake(10, 10, 200, 40)];
[self.view addSubview:transitionButton];
}

- (void)animation
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:NextPage forView:[self.view viewWithTag:88] cache:NO];
[UIView commitAnimations];
}

- (void)dealloc
{
[super dealloc];
}

@end



ArtOfWarfare
Dec 12, 2009, 11:21 PM
I never knew about them, but then I've only used the most basic of transitions in my apps thus far. Thus far my most complicated animation has been having a UIPickerView slide up from the bottom of the screen.

Darkroom
Dec 13, 2009, 07:52 AM
it's too bad the animationTransition:110 is painfully slow when used for a UIImage, although i'm willing to bet it would function without delay on a vector based image.

Luke Redpath
Dec 13, 2009, 08:35 AM
Given these are undocumented and private you should not be using them in your apps if you plan on distributing them via the app store.