1

我想翻动按钮单击视图的动画,以便我可以在同一个视图控制器上更改文本和图像,并且可以在我的iPhone应用程序中给出很酷的动画。 我已经perviously使用此代码翻动过渡: -几秒钟后翻转iPhone viewController显示数据变化

[self.navigationController pushViewController: viewControllerName animated:NO]; 
[UIView setAnimationDuration: 0.7]; 
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO]; 
[UIView commitAnimations]; 

,但它会推动,我不想要一个新的视图控制器。 我要翻盖上相同的观点

请帮助这个动画。

回答

1

你试过[yourViewController.view setNeedsDisplay]

+0

我正在寻找有点类似的问题...呵呵呵感谢 – LolaRun

1

这就是你需要的一切。这会翻转你的视图而不需要第二个视图。它提供了在动画和后期进行更改的地方。

[UIView transitionWithView:MYVIEW duration:0.7 options:UIViewAnimationOptionTransitionFlipFromRight animations:^{ 
    // Make your changes to the view here. 
} completion:^(BOOL finished) { 
    // Do any cleanup necessary here. 
}]; 
+0

嗨瑞安, 感谢您的帮助。它几乎可以做到这一点,但它会在翻转时显示以前的数据,然后正确显示所有内容。 我想显示视图的背景图片,当它翻转时显示。请帮助 – user1288005

+0

您需要在动画中更改背景图片。我在这里对改变的地方发表评论。你在清理中做的任何事情都会在之后发生。您在动画过程中做的任何事情都会在此期间发生 –

0

你可以试试这个代码...这对我来说很好。

flipView=[[FlipMyGuideViewController alloc]init]; 

    [UIView beginAnimations:nil context:nil]; 
    [UIView setAnimationDuration:1.0]; 
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft 
          forView:[self view] 
          cache:YES]; 


    [self.view addSubview:flipView.view]; 


    [UIView commitAnimations];