useboot
useboot

Reputation: 77

UILabel: change a text color when click button

I am beginner in iOS programming.

So, I want to change the text color when user click button.

My code:

- (IBAction)buttonGetText:(id)sender {
self.textChange.textColor = "red"; 
}

But it doesn't work. What do I need to do? Thank you everyone.

Upvotes: 0

Views: 688

Answers (1)

Antonio MG
Antonio MG

Reputation: 20410

This:

self.textChange.textColor = "red"; 

Doesn't make sense, you need to use UIColor.

Try this:

self.textChange.textColor = [UIColor redColor]; 

Upvotes: 1

Related Questions