【发布时间】:2011-04-24 16:55:23
【问题描述】:
我刚刚将我的 iPhone 4 从 iOS 4.2.1 升级到 4.3.2 和 XCode 4.0.2,我遇到了一些奇怪的 uiview 动画问题。当我第一次启动我的应用程序时,这样的代码可以完美执行:
[UIView beginAnimations:@"fadeAlphaIn" context:nil];
[UIView setAnimationDuration:0.5f];
viewClue.alpha = 1.0f;
[UIView commitAnimations];
但是,在通过标准方法关闭呈现然后关闭模态视图之后:
[self presentModalViewController:more animated:YES];
和
[self dismissModalViewControllerAnimated:YES];
第一个动画不再起作用。例如,viewClue 视图不会淡入,而是简单地从 alpha = 0 跳转到 alpha = 1。类似地,改变其他视图的 frame 属性的其他动画只是强制帧从初始值跳转到最终值而没有动画。这些动画在模态视图出现和关闭之前运行良好。
我了解其他人在升级到 iOS 4.3.2 时遇到了动画问题,但模态视图破坏动画的方式似乎很奇怪。有没有其他人遇到过这个问题?关于解决方案的任何想法?我正在考虑将模态视图添加为子视图,并在它隐藏和出现时对其进行动画处理,但最好使用标准的模态视图方法。
感谢您的帮助,
詹姆斯
编辑:更多代码显示应用程序的地图是如何动画的
-(void) viewMapfunc
{
AudioServicesPlaySystemSound(soundID);
if(mapvisible){
[UIView animateWithDuration:0.5
delay:0.1
options:UIViewAnimationOptionAllowUserInteraction
animations:^{
map.frame = CGRectMake(0, 350, 320, 27);
mapscroll.frame = CGRectMake(0, 27, 320, 0);
}
completion:nil];
mapvisible = NO;
viewMapLabel.text = @"View Map";
}else {
[UIView animateWithDuration:0.5
delay:0.1
options:UIViewAnimationOptionAllowUserInteraction
animations:^{
map.frame = CGRectMake(0, 50, 320, 300);
mapscroll.frame = CGRectMake(0, 27, 320, 300);
}
completion:nil];
mapvisible = YES;
viewMapLabel.text = @"Hide Map";
}
}
【问题讨论】:
-
确保在未连接调试器的设备上存在此问题。在模拟器上调试时,我注意到一些奇怪的动画行为
标签: iphone