开发者

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

I want to hide/unhide controls of a subview in a view. For example: When a bu开发者_如何学Ctton 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.


Here is the answer:

[label1 setHidden:YES];

YES is Objective-C's version of true.


To hide a label:

self.yourlabelname.hidden = YES;


Use [self.view addsubview:self.label]; to make the label visible.

Use [self.label removefromSuperview]; to remove from Superview.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜