Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)?

like image 616
Zakman411 Avatar asked Dec 08 '25 01:12

Zakman411


1 Answers

Something like this should do.

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

You can see the docs for both methods here.

like image 74
Nikita Rybak Avatar answered Dec 10 '25 15:12

Nikita Rybak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!