Zakman411 Zakman411 - 1 year ago 81
Objective-C Question

Show/Hide Label (w/ Toggle Button)

I have an application I'm working on where I need a button (upon click) to show/hide a label. I set up the label as an IBOutlet, and the button as an IBAction - but don't really know where to go from here. I'm still very new to cocoa - I figure it's pretty simple but objective-c is daunting to me. Any help (in dummies terms)?

Answer Source

Something like this should do.

if ([theLabel isHidden]) {
    [theLabel setHidden:NO];
} else {
    [theLabel setHidden:YES];

You can see the docs for both methods here.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download