在代码中检测iOS模拟器中是否打开/关闭慢动画

hfo*_*sli 13 xcode animation core-animation ios ios-simulator

我想以编程方式检测慢速动画是否在模拟器中打开或关闭.

像这样的东西会很方便.

IPHONE_SIMULATOR_SLOW_ANIMATIONS_ENABLED()
Run Code Online (Sandbox Code Playgroud)

这仅用于开发目的.

Nik*_*uhe 8

幸运的是,这很简单:

float UIAnimationDragCoefficient(void);

static inline BOOL slowAnimationsEnabled()
{
#if TARGET_IPHONE_SIMULATOR
    return UIAnimationDragCoefficient() != 1;
#else
    return NO;
#endif
}
Run Code Online (Sandbox Code Playgroud)