Take the 2-minute tour ×

This code seems to work well, modifying the properties of my button, except the titleLabel font color is not changing. I can change the font, font size, shadow but not the color. It currently displays as white although I am trying to set it to black. I've tried button1.titleLabel.textColor = [UIColor blackColor]; and [button1.titleLabel setTextColor:[UIColor blackColor]]; seems to recognize the property but still remains white.

[button1.titleLabel setTextColor:[UIColor blackColor]];        
[button1.titleLabel setFont:[UIFont boldSystemFontOfSize:20]];
[button1.titleLabel setShadowColor:[UIColor blackColor]];
[button1.titleLabel setShadowOffset:CGSizeMake(-1, 1)];
[button1 setTitle:@"Do it" forState:UIControlStateNormal];
button1.frame = CGRectMake(0, 0, 250, 40.0);
[myView addSubview:button1];
share|improve this question

1 Answer 1

up vote 10 down vote accepted

This worked.

[button1 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
share|improve this answer
EmptyStack answered this at the same , thanks!! –  Mrwolfy Jun 29 '12 at 9:03

Your Answer


