真实设备中的动画比模拟器快得多
我正在制作按钮上图像变化的动画。我将时间设置为 0.6,模拟器中的动画效果与预期完全一致,但在 iPhone 4S 中,相同的动画在一眨眼的时间内发生,而不是 0.6 秒。
我已将动画持续时间更改为更短和更长,模拟器始终按预期工作,但真实设备始终超快,例如 0.1 秒或更快。
真实设备上的其他动画(例如更改视图控制器翻转过渡)都很好。
代码示例如下:
for (button in allButtons) {
[UIView transitionWithView:button.view duration:0.6
^{ [button setSelected:NO];
}
}
allButtons 集合中有 80 个按钮。单独的按钮转换效果也很好。
为什么模拟器的工作方式与真实设备不同?
I'm animating the change of image on buttons. I have the time set to .6 which animates in the emulator exactly as expected but in iPhone 4S the same animation happens in a blink, not .6 seconds.
I've changed the animation duration to be shorter and longer, the emulator always works as expected but the real device is always super fast, like .1 second or faster.
Other animations on the real device like changing view controllers flip transition are fine.
Code sample like this:
for (button in allButtons) {
[UIView transitionWithView:button.view duration:0.6
^{ [button setSelected:NO];
}
}
There are 80 buttons in the allButtons collection. Individual button transitions work fine as well.
Why does the emulator work differently than the real device?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
评论(2)
你可以尝试:
[UIView animateWithDuration:0.6
animations:^{
for (UIButton *button in allButtons) {
[button setSelected:NO];
}
}];
但这也不应该起作用(正如 Diwann 之前所说)。文档说明了什么是可动画的,并且“selected”属性不在该列表中,事实上它甚至不是 UIView 的属性,它是UIControl 只能为 UIView 的属性设置动画。
我刚刚在我的模拟器和 iOS 设备上尝试了你的伪代码(可以正常工作),但都没有动画。两个测试都将按钮设置为同时选择。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我不确定选择属性是否可动画?
看看:“什么可以动画化?”
http://developer.apple.com/库/ios/#documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/AnimatingViews/AnimatingViews.html
I am not sure if the selection property is animable ?
look at : "what can be animated ?"
http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/AnimatingViews/AnimatingViews.html