How can I change UIButton title color?

Ads
 

How can I change UIButton title color?

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

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

Ads









Related Tutorials/Questions & Answers:
How can I change UIButton title color?
I want to change my user name on your website ,how can i do this
Advertisements
How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD using JAVA or Net Beans ???
How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD using JAVA or Net Beans ???
How do I change a large string into hex and then into byte so that SHA1 can be applied to it?
Change panel height, width and title
UIButton setTitle forState
How can I do it? .click();
How can I learn Java?
how should i can solve
How to print UIButton id
how can i add hibernate plugin to eclipse?
how i can get jqfade.js library
how can i display a pdf file in a jtextarea
how can i remove newline characters and tabs
how can i make monthly register ?
how can i display a editable result of form?
how can i create a discussion forum?
How can i modify my account in roseindia
How can I master Java in one month?
how can i print the selected content of a frame
How can i use Facebook connect button
How can I create sessionfactory in Hibernate?
How can I show users privileges in MySQL?
How I can cast a variable in Scala?
How I can cast a variable in Scala?
ModuleNotFoundError: No module named 'colord'
ModuleNotFoundError: No module named 'colorp'
ModuleNotFoundError: No module named 'colory'
ModuleNotFoundError: No module named 'colorz'
how can i set an object in focus

Ads