hello all i have a simple view which has a button. on the button's tap i am loading a new view which contain a navigation bar and a UITableView.is there any way i can animate a flip effect on button's tap and load the view and also vice versa?
+1
A:
Sure, here is some code that may help
- (void)flipAction:(id)sender
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.75];
// checks to see if the view is attached
[UIView setAnimationTransition:([logTextView superview] ?
UIViewAnimationTransitionFlipFromLeft : UIViewAnimationTransitionFlipFromRight)
forView:[self view] cache:YES];
[UIView setAnimationTransition:([logTextView superview] ?
UIViewAnimationTransitionFlipFromLeft : UIViewAnimationTransitionFlipFromRight)
forView:[[self navigationController] view] cache:YES];
if ([logTextView superview])
{
[logTextView removeFromSuperview];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"FTP Log", nil) style:UIBarButtonItemStyleBordered target:self action:@selector(viewFtpLog)];
}
else
{
[[self view] addSubview:logTextView];
[[[self navigationItem] rightBarButtonItem] release];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Done", nil) style:UIBarButtonItemStyleDone target:self action:@selector(flipAction:)];
}
[UIView commitAnimations];
}
For you, you might want to get the UIView for your table view. The button is what triggers the flip
Heat Miser
2009-05-20 06:09:37
Also, I am keeping a reference to logTextView as an @property in my UIViewController
Heat Miser
2009-05-20 06:10:35