Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Mobile-Applications How can I change UIButton title color?

Have Programming Question? Ask it here!
 
 
 


Deepak Kumar
How can I change UIButton title color?
2 Answer(s)      3 years and 7 months ago
Posted in : MobileApplications


Hi,

I have a button in my iPhone/iPad application. I want to change the color of the text when user clicks on it making it selected.

Provide me good example code.

Thanks


Advertisement
View Answers

January 2, 2011 at 2:30 PM


Hi,

You have to set the color of the button for a particular state say: forSelected.

Use the following code:

[myButtonsetTitleColor:[UIColor redColor] forState:UIControlStateNormal];

Thanks



January 2, 2011 at 2:31 PM


Hi,

There is space between myButton setTitleColor.

Here is corrected code:

[myButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];

Thanks



Related Tutorials/Questions & Answers:
Advertisements
Advertisements
 

 

 

DMCA.com