Flip preview in iPhone?

I have UIView

one that has a button. On clicking the button, I show a new UIView

one that contains UINavigationBar

and UITableView

. Is there a way to animate the reset effect on button click and load the view, and vice versa?

+1


a source to share


1 answer


Of course, here's some code that might 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 may need to get the UIView for your table view. The button is what triggers the flip

+1


a source







All Articles