Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
am i the only person who didn't know about this?

Code:
#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
 
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.
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.