Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide UIButton title

I have several UIButtons in a scrollview which I use in order to pass certain information. The information is saved in the title of each uibutton and when the button is clicked, it passes its title into the function.

All I want to do is hide the title of the button so you can not see the button. I have them overlaid over images which I use to show buttons. I have the text set to transparent but it still turns white when it is being clicked.

If you include code in your explanation, please explain where it should go.

like image 579
kris Avatar asked Sep 04 '11 16:09

kris


1 Answers

After IOS7, If you want to just hide the title on titleLabel of a button you can do as follow. This way the title is still there it just makes it invisible. if you do NSLog("%@",button.currentTitle) you will see the title in terminal. Hope this helps.

[button setTitle:@"Button Title" forState:UIControlStateNormal];
button.titleLabel.layer.opacity = 0.0f;
like image 56
Ohmy Avatar answered Sep 28 '22 11:09

Ohmy