【问题标题】:How to change pop view controller animation on back button?如何更改后退按钮上的弹出视图控制器动画?
【发布时间】:2011-02-25 21:35:35
【问题描述】:

我正在使用以下语句推送我的视图控制器:

[[self navigationController] pushViewController:self.customViewController animatedWithTransition:UIViewAnimationTransitionFlipFromLeft];

现在,当我按下后退按钮时,我想使用 uiviewanimationtransitionflipfromright 对其进行动画处理。

喜欢

[self.navigationController popViewControllerAnimatedWithTransition:UIViewAnimationTransitionFlipFromLeft];

我该怎么做?

谢谢

【问题讨论】:

    标签: iphone animation uinavigationcontroller


    【解决方案1】:

    【讨论】:

      【解决方案2】:

      这有助于您在后退按钮中为视图设置动画。

      [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];
      

      【讨论】:

        【解决方案3】:

        对于推送:

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

        对于流行音乐:

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

        https://stackoverflow.com/a/5889757/1915820

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-01-01
          • 1970-01-01
          相关资源
          最近更新 更多