There’s very useful debugging feature in iOS simulator – Toggle slow animations, but it’s only a simulator functionality and there’s no way to have the same while debugging on device. Or is it?
Well, there’s very hidden and unobvious but still working way to achieve the same.
Hit pause while running app on device. lldb will stop at some point, most probably deep in system code, it doesn’t matter.
Type in console following command in AppDelegate.m didFinishLaunchingWithOptions: method
Hit pause while running app on device. lldb will stop at some point, most probably deep in system code, it doesn’t matter.
Type in console following command in AppDelegate.m didFinishLaunchingWithOptions: method
[(CALayer *)[[[[UIApplication sharedApplication] windows] objectAtIndex:0] layer] setSpeed:.1f];
Now all the animations – system, initiated from your code directly using any API, will be adjusted to master speed which you just modified.
To understand how it actually works you should recall that CALayer conforms to CAMediaTiming protocol and using this protocol’s methods we can control animation options of entire layer’s tree.
No comments:
Post a Comment