程序人生

导航

iphone UIView animation

//Flips to back when toggle button is pressed
- (IBAction)toggleView:(id)sender {
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:
1.0];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight
                           forView:[self view]
                             cache:YES];
    [[self view] addSubview:secondaryView];
    [UIView commitAnimations];
}

//Flips to front when "Done" is pressed
- (IBAction)returnView:(id)sender {
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:
1.0];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
                           forView:[self view]
                             cache:YES];
    [secondaryView removeFromSuperview];
    [UIView commitAnimations];
}

posted on 2011-06-16 11:25  Leon.Cao  阅读(245)  评论(0编辑  收藏  举报