开发者

Debugging iOS: How do I break on property value change?

开发者 https://www.devze.com 2023-03-26 16:22 出处:网络
I am trying to find out how a UIViews transformation matrix is being modified. Thus (using the gdb console) I\'d like to watch for any/all changes of the UIView\'s transform prop开发者_Go百科erty. How

I am trying to find out how a UIViews transformation matrix is being modified. Thus (using the gdb console) I'd like to watch for any/all changes of the UIView's transform prop开发者_Go百科erty. How would I go about doing so?


Add a symbolic breakpoint in Xcode. Use -[UIView setTransform:] as the Symbol.

Use a more narrow subclass class if you want less or more specific output.


Use a symbolic breakpoint -[UIView setTransform:]. Note that you can also use a condition with $arg1 (works only on 64bit simulator like iphone 5s) compared to some pointer to catch breakpoints on property change only for a specific instance $arg1 == 0x7f9cbba75e60. Screenshot below shows a breakpoint that catches changes on transform property only for UIView instance that has a pointer 0x7f9cbba75e60

Debugging iOS: How do I break on property value change?


If you're like me, and don't write in Obj-C, here's a quick Swift way to do it for beginners.

Debugging iOS: How do I break on property value change?

Just add a didSet to the property, and a breakpoint inside the block.

0

精彩评论

暂无评论...
验证码 换一张
取 消