【问题标题】:show view after animation动画后显示视图
【发布时间】:2013-03-05 05:08:07
【问题描述】:
我正在使用页面卷曲动画。我正在查看一个问题,当我单击按钮时,它会动画页面卷曲并显示黑屏。但是我想在页面卷曲后再次用不同的问题显示相同的视图。页面卷曲动画后如何显示不同问题的相同视图?
我正在使用下面的代码
[UIView beginAnimations:@"partialPageCurlUp" context:nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationsEnabled:YES];
[UIView setAnimationDelegate:self];
[UIView setAnimationsEnabled:YES];
[UIView
setAnimationTransition: UIViewAnimationTransitionCurlUp
forView:self.view cache:YES];
[UIView commitAnimations];
[super viewDidLayoutSubviews];
只是想知道下一步该做什么?
【问题讨论】:
标签:
iphone
ios
animation
uiview
【解决方案1】:
[UIView animateWithDuration:0.25 animations: ^{ // your animation code hear } completion:^ (BOOL finished) { if (finished) { // Your Animation Completion call back. NSLog(@"Is completed"); } } ];
试试这个方法。
【解决方案2】:
看到你只需要实现更多的东西
在您现有的代码中添加动画停止选择器,以便您可以获得动画结束点可以显示下一个问题
[UIView setAnimationDidStopSelector:@selector(animationDidStopFinished)];
animationDidStopFinished 这将是另一个method,您应该编写一些代码,在动画完成时显示另一个问题。
或使用下面的代码
[UIView animateWithDuration:1.5 delay:.00 options:UIViewAnimationTransitionFlipFromLeft animations:^
{
//here you should write animation code
[UIView
setAnimationTransition: UIViewAnimationTransitionCurlUp
forView:self.view cache:YES];
}
completion:^ (BOOL finished) {
if (finished) {
// Here You may show Next Question as animation gets stop;
}
}];