-1

我在导航栏的左侧有一个“过滤器”按钮。单击它时,我希望在切换到下一个视图时具有 1.5 秒的翻转延迟的翻转动画。如何为此添加代码?

我正在使用此导航代码:

FilterViewController *vc = [[FilterViewController alloc] init];
vc.delegate = self;

[self.delegate pushViewController:vc  animated:UIViewAnimationTransitionFlipFromLeft];

[vc release];

现在我希望通过按钮切换视图时的翻转延迟为 1.5 秒。我已经尝试了一些代码,但它没有给我想要的结果。

4

2 回答 2

1

试试这个

    [UIView beginAnimations:@"View Flip" context:nil];
    [UIView setAnimationDuration:1.5];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight 
                           forView:self.navigationController.view cache:NO];

    [self.navigationController pushViewController:vc animated:YES];
    [UIView commitAnimations];

    [vc release];

取自如何在单击信息按钮时在两个 UIViewControllers 之间进行翻转动画?

另一种方式:

MainView *nextView = [[MainView alloc] init];
[UIView animateWithDuration:0.75
                         animations:^{
                             [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
                             [super pushViewController:nextView animated:NO];
                             [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
                         }];

我从如何更改基于导航的应用程序中的推送和弹出动画中得到这个

于 2012-12-26T12:22:40.210 回答
0

使用它来延迟推送动画:

FilterViewController *vc = [[FilterViewController alloc] init];
vc.delegate = self;
[self performSelector:@selector(callViewController:) withObject:vc afterDelay:1.5];

-(void)callViewController:(FilterViewController*)vc{
    [self.delegate pushViewController:vc  animated:UIViewAnimationTransitionFlipFromLeft];
    [vc release];
}
于 2012-12-26T12:35:01.663 回答