Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objective-c - iOS - hide/unhide label, textfield etc

I want to hide/unhide controls of a subview in a view. For example: When a button action occurs, some labels will become hidden then unhide on a subsequent button action and so on. I have implemented this functionality through Interface Builder. How can I do the same implementation programmatically?

I've tried

[label1 hidden: true];

which hasn't worked for me.

like image 491
Firejs Avatar asked Apr 29 '11 08:04

Firejs


2 Answers

Here is the answer:

[label1 setHidden:YES];

YES is Objective-C's version of true.

like image 126
necixy Avatar answered Dec 10 '22 21:12

necixy


To hide a label:

self.yourlabelname.hidden = YES;
like image 20
Aswathy Bose Avatar answered Dec 10 '22 21:12

Aswathy Bose