在我的 iOS 应用程序中,我的屏幕上有一堆具有摆动效果的图标。当我按住其中一个时,它们开始摇晃(就像 iPhone 的菜单一样),但如果我按下主页按钮(将我的应用程序发送到后台),iPhone 就会卡住!一段时间后,它会自行重新启动。这是我用来实现效果的源:
CABasicAnimation* anim = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
[anim setToValue:[NSNumber numberWithFloat:0.0f]];
[anim setFromValue:[NSNumber numberWithDouble:M_PI/30]];
[anim setDuration:0.1];
[anim setRepeatCount:NSUIntegerMax];
[anim setAutoreverses:YES];
[self.layer addAnimation:anim forKey:@"SpringboardShake"];
并停止:
[self.layer removeAllAnimations];
此问题仅发生在 iOS 5 中。相同的代码在 iOS 4 中运行良好。您知道什么会导致我的设备死机吗?
最佳答案
我也遇到了同样的问题。可以找到解决方案here .
要获得流畅的动画,您需要提高计算速度。因此,一种形式是减少我们需要计算的东西。
关于ios - 我的应用程序中的摆动(摇动)效果导致 iPhone 卡住(iOS 5),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9925029/