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

computerartist

macrumors newbie
Original poster
Sep 4, 2010
28
0
I am trying to use a "Flip" transition/animation. On both sides I want to have 2 separate UITables.


The following code that I am trying to do this with works fine, but it obviously "Flips" with the same view:


Code:
	CGContextRef context = UIGraphicsGetCurrentContext();
	[UIView beginAnimations:nil context:context];
	[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];
	[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
	[UIView setAnimationDuration:1.0];
	[self.view exchangeSubviewAtIndex:0 withSubviewAtIndex:1];
	[UIView commitAnimations];


I don't know where I would include the second UITable for the backside?
 
Even simpler...use two view controllers, one for the front, one for the back (they would both be UITableViewController subclasses in your case).

Present the back as a modal view controller and set the modal transition style of the back view controller to UIModalTransitionStyleFlipHorizontal. No animation blocks, no view swapping, both views managed by their own controller so your code is cleaner, simple.
 
I understand all of that, but I don't know where to start touse two view controllers,:


"one for the front, one for the back"


???
 
I have the following code now that is working.

The problem I am running into now though is that the UINavigationController is flipping too:


Code:
	DetailViewControllerLatestElectionPolls *controller = [[DetailViewControllerLatestElectionPolls alloc] initWithNibName:@"DetailView" bundle:nil];
	UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller];
	[controller release];
	navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
	[self presentModalViewController:navController animated:YES];
	[navController release];
 
My solution isn't going to work for you if you are using a navigation controller and don't want it to flip, something you failed to mention in your first post.
 
I didnt know it would make a difference.

So I need to use an animation block? That is good to know because I still can't figure this out.

Any suggestions of what I am doing wrong?

Code:
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:1.0];
[self.view exchangeSubviewAtIndex:0 withSubviewAtIndex:1];
[UIView commitAnimations];
 
Yes, but what I am having a problem with is:

What I am trying to do is to make the Application Delegate Navigation Controller the Navigation Controller for a programmatically inserted tableView (only the view, not the view with navigation controller... if this is possible.



What I was hoping for is that I could do something like the following:


Code:
navController = tableViewAppDelegate.navigationController;



Code:
	tableViewAppDelegate = (TableViewAppDelegate *) [[UIApplication sharedApplication] delegate];

	DetailViewControllerSenateNoTossUp *cnewTableViewFrameController = [[DetailViewControllerSenateNoTossUp alloc] initWithNibName:@"DetailView" bundle:nil];
	UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:newTableViewFrameController];
	


	CGRect newTableViewFrame;
	newTableViewFrame.origin.x = 0; 
	newTableViewFrame.origin.y = 0;
	newTableViewFrame.size.height = 200;
	newTableViewFrame.size.width = 280;
	
	UIView *newTableView = [[UIView alloc] initWithFrame: newTableViewFrame];
	newTableView = newTableViewFrameController.view;
	
	[self.view addSubview:newTableViewFrameController.view];
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.