Enable slow animation while debugging using an iOS device

I am using xCode 4.3.1 and I need to use a parameter that iOS Simulator has => Debug -> Toggle Slow Animation, but when debugging using an iOS device.

Is it possible?

+50
ios xcode ios5
Apr 19 2018-12-12T00:
source share
5 answers

This is not possible exactly the same as with Simulator, but there is a good way to achieve the same effect with lldb.

Use the debugger to pause code execution, and then enter the command:

p [(CALayer *)[[[[UIApplication sharedApplication] windows] objectAtIndex:0] layer] setSpeed:.1f] 

into the debugger.

Thanks to this link for the solution.

+142
Apr 03 '13 at 13:28
source share

In Swift 3:

 UIApplication.shared.windows.first?.layer.speed = 0.1 

Or, if you are somewhere in your AppDelegate and use only one window, you can do this:

 window?.layer.speed = 0.1 
+18
19 Oct '16 at 19:38
source share

For Swift :

Stop your code with a breakpoint and enter the following lldb command:

(lldb) p UIApplication.sharedApplication().windows.first?.layer.speed = 0.1




Alternatively, you can also change the speed somewhere in your code. For example, with the #if preprocessor macro when starting the application

 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { ... #if DEBUG application.windows.first?.layer.speed = 0.1 #endif 

Remember to set the DEBUG symbol in the "Swift Compiler - Custom Flags", "Other Swift Flags" section. You add the DEBUG character with the -DDEBUG .

+15
Nov 25 '15 at 0:51
source share

Objective-C works pretty well

 self.window.layer.speed = .1f; 
0
Feb 27 '18 at 13:48
source share

If you want to slow down the application in only one view controller, you can set a breakpoint to continue execution after the command is executed. You set this breakpoint viewDidAppear to viewDidAppear . Then you can set another "unstoppable" breakpoint to change the speed to 1X. You set this other viewDidDisappear to viewDidDisappear .

Very simple. It can be saved and deactivated in your list of breakpoints and can be easily used if necessary.

0
Jun 10 '19 at 12:52 on
source share



All Articles