2011-05-21 16 views
30

Me enfrenta a un problema extraño. Estoy cambiando el color del texto de mi botón cuando está resaltado pero visualmente no cambia nada.Cambio en el color del texto del botón que no refleja

[myButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 
[myButton setTitleColor:[UIColor colorWithRed:150.0 green:150.0 blue:150.0 alpha:1.0] forState:UIControlStateHighlighted]; 

¿Falta algo?

Respuesta

71

intento: componentes

[myButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 
[myButton setTitleColor:[UIColor colorWithRed:150.0/256.0 green:150.0/256.0 blue:150.0/256.0 alpha:1.0] forState:UIControlStateHighlighted]; 

color son los flotadores entre 0,0 y 1,0!

+4

Los componentes de Color son flotantes entre 0.0 y 1.0, pero el índice comienza en 0: 'float/255.0' Debería ser:' [UIColor colorWithRed: 150.0/255.0 verde: 150.0/255.0 azul: 150.0/255.0 alpha: 1.0 ] ' –

Cuestiones relacionadas