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]
精彩评论