开发者

How do I hide the text on a label in Obj-C?

I'm using label of a button to send a value into a function. However, I want the button to be invisible. I have the background color turned of in IB, and the tex开发者_运维技巧t color is also set to nothing, but the text still shows up on the button.

Is there another way to have a clear button that sends a value when it's clicked?

If I could just turn off / hide the text on the stock UIButton that would be perfect...


you can do something like

MyButton.titleLabel.alpha = 0.0;


[MyButton setHidden:YES] to Hide And

[MyButton setHidden:NO] to Unhide the button.

use:

[MyButton setEnable:NO];
[MyButton setHighlighted:YES];
[MyButton setEnable:YES];

to Hide

And

[MyButton setEnable:NO];
[MyButton setHighlighted:YES];
[MyButton setEnable:NO];

to unhide.


Note: while some may find it overly pedantic the question should not be how can I hide the text of a label in Objective C but how do I hide the text of a button in cocoa touch.

Also agreeing with marcc, using the label of a button to send a value into a function sounds a bit iffy. May we ask for context as why you want an invisible button? Or do you just want a transparent button with no text? If so does it have any images? How would the user have any clue of what it does?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜