iPhone - 弹出导航控制器时翻转动画

时间:2012-08-28 09:49:00

标签: ios iphone

如何在导航控制器弹出时翻转动画,我们如何实现这个

2 个答案:

答案 0 :(得分:0)

关注流行视图的翻转动画代码

[UIView  beginAnimations:nil context:NULL];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.75];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[UIView commitAnimations];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelay:0.375];
[self.navigationController popViewControllerAnimated:NO];
[UIView commitAnimations];

以下动画块代码

[UIView animateWithDuration:0.75
                         animations:^{
                             [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
                             [UIView setAnimationTransition:transition forView:self.navigationController.view cache:NO];
                         }];
[self.navigationController popViewControllerAnimated:NO];

答案 1 :(得分:0)

尝试以下代码将视图推送到下一个视图。

-(IBAction)gotonextView:(id)sender
{
NextView *info = [[NextView alloc]initWithNibName:@"NextView" bundle:nil];
        UINavigationController * nvc = [[UINavigationController alloc] initWithRootViewController:info];

        info.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [self.navigationController presentModalViewController:nvc animated:YES];

}

自动弹出时你会得到相同的翻转动画。