所以我试图在两个图像之间切换,但持续时间似乎被忽略了。我知道苹果必须非常快地制作一些动画来保持魔力,但有办法减缓翻转速度吗?
我当前的对象层次结构是游戏板,其中包含许多从UIView继承的卡。卡的正面和背面都是UIViews,其中包含UIImage和其他数据
[UIView animateWithDuration:15.0
animations:^(void) {
cardOne.center =CGPointMake(100, 100);
cardTwo.center =CGPointMake(100, 100);
//low level calls, to directly perform the image swap
[cardOne.face removeFromSuperview];
[cardOne addSubview:cardOne.back];
[cardOne sendSubviewToBack:cardOne.face];
//calling the transitionFromView to do the image swap
[UIView transitionFromView:cardOne.face
toView:cardOne.back
duration:10
options:UIViewAnimationTransitionFlipFromLeft
completion:^(BOOL finished){ }];
感谢您的反馈。我试着把你们所有的输入都混合在一起,结果确实能正常工作。我还不知道为什么。感谢您的回复。我试着恢复旧的风格,结果成功了。我还没有弄清楚为什么。
非工作代码被注释掉,而工作代码则不被注释。再次感谢
/*
[UIView animateWithDuration:animationDuration
animations:^{
[self.face removeFromSuperview];
[self addSubview:self.back];
[self sendSubviewToBack:self.face];
}];
*/
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:kDefaultFlipSpeed];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
forView:self
cache:YES];
[self.face removeFromSuperview];
[self addSubview:self.back];
[self sendSubviewToBack: self.face];
[UIView commitAnimations];
我不能在评论中提问,所以:你试过用不到10秒的时间吗?更准确地说,在0-1秒之间。大约0.5秒。如果您注意到这些值的持续时间有任何变化,请告诉我。
我的快速回答是:尝试将10秒设置为10.0
或10.0f
。
希望能有所帮助。