views:

159

answers:

1

This screenshot explains it all: alt text

The screenshot shows the debugger reporting buttonType as 2 but the console showing button type = 0. The same variable is being shown in the debugger and the console. Any idea how this mismatch happens?

(gdb) po ((UIButton *)control).buttonType

There is no member named buttonType.

As requested:

    NSLog(@"################ CALL OUT ACCESSORY TAPPED: set pinColor to RED in call out accessory tapped");
    NSLog(@"################ CALL OUT ACCESSORY TAPPED: UIButtonTypeDetailDisclosure = %d",UIButtonTypeDetailDisclosure);
    NSLog(@"################ CALL OUT ACCESSORY TAPPED: control button type = %d", ((UIButton *)control).buttonType);

    if (((UIButton *)control).buttonType == 2) {
        NSLog(@" ############# CALL OUT ACCESSORY TAPPED: in buttonType = disclosure");
        leftCallOutButton.available = YES;
    }

The if statements evaluates to false!! Trying to understand why if buttonType is being reported as 2 (and if fact is created with type 2 )

as request by Mike:

(gdb) p (int) [((UIButton *)control) buttonType]
$1 = 0
2009-12-31 14:04:26.821 iParkNow![4432:207] ################ CALL OUT ACCESSORY TAPPED: control button type = 0
(gdb) p (int) [((UIButton *)control) buttonType]

Ok, so this makes more sense. The question now is why is the buttonType being changed from 2 to 0? Its created with buttonType 2 and somehow gets changed to 0. Any ideas??

+2  A: 

_buttonFlags is a private instance struct. You should not worry about it. The only thing that is "guaranteed" to work as you expect is the public API - implementation details are subject to change.

(As a side-note, a variable prefaced with _ is usually a private instance variable)

In your case, try p (int) [((UIButton *)control) buttonType].

You can also consider creating a breakpoint action to log whatever you want at a breakpoint you set. See http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/XcodeDebugging/200-Managing_Program_Execution/program_execution.html for more details.

Mike
ok, then how do I check the value of buttonType in the debugger?
ennuikiller
@Mike, please the result of print object in my question. Its not able to resolve that variable.
ennuikiller