开发者

How to find attribute value in debugger?

开发者 https://www.devze.com 2022-12-29 05:03 出处:网络
I have a button and would like to know its enabled state while stepping through code.This doesn\'t work in the debugger:

I have a button and would like to know its enabled state while stepping through code. This doesn't work in the debugger:

po self.myButton.enabled

It prints:

There is no member named enabled.

Is there another way开发者_如何转开发 to print out its state?


gdb doesn't know dot-syntax for properties, but it will evaluate method calls. -[UIButton enabled] returns a BOOL, which is a scalar type, not an object, so you should use p with a type cast, like this:

p (BOOL)[[self myButton] enabled]

If the property you want to inspect is an object, you can use po without the type cast, like this:

po [[self myButton] font]
0

精彩评论

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