views:

945

answers:

1

I create a button programmatically

button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self 
       action:@selector(aMethod:)
forControlEvents:UIControlEventTouchDown];
[button setTitle:@"Show View" forState:UIControlStateNormal];
button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
[view addSubview:button];

how can I change title color?

+4  A: 

You can use -[UIButton setTitleColor:forState:] to do this.

Ben Gottlieb
For instance [buttonName setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
dkberktas