Search code examples
objective-ccocoansbutton

Obj C - Checking Current State of a Disclosure Arrow


I'm trying to differentiate between a disclose arrow being 'On' (pointed down) or 'Off' (pointed up). The posted code is completely wrong and just the general idea of what I want it to do.

- (IBAction)disclosureArrow:(NSControl *)sender{

if (disclosureArrow currentState:ON) {
    //action
}

IBOutlet id discloseArrow is attached to the disclose button in interface builder and it receives a command from IBAction that is also attached to the button. How do I check the button's current state ? (In regards to disclosure arrows.)


Solution

  • I believe:

    BOOL isOn = ([sender state] == NSOnState);
    

    Should do the trick.