简体   繁体   中英

Animation much faster in real device than emulator

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?

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

You could try:

    [UIView animateWithDuration:0.6
                 animations:^{ 
                     for (UIButton *button in allButtons) {
                         [button setSelected:NO];
                     }
                 }];

But this shouldn't work either (as Diwann said earlier.) The documentation states what is animatable and the "selected" property is not in that list, in fact its not even a property of UIView, it's a property of UIControl and you can only animate properties of UIView.

I just tried your pseudo code (made to work) on my simulator and iOS device and neither animated. Both tests set the buttons to selected all at once.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM