Pregunta

Estoy tratando de establecer el color de sombra en un UIButton, pero todo lo que parece ser capaz de obtener es un gris medio.

UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = CGRectMake(20, 20, 200, 100);

[button setTitle:@"a" forState:UIControlStateNormal];

[button addTarget:self 
           action:@selector(buttonPressed:) 
 forControlEvents:UIControlEventTouchUpInside];

[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[button.titleLabel setFont:[UIFont fontWithName:@"Helvetica" size:96]];

// set up the button colours 
button.titleLabel.shadowColor = [UIColor blueColor];
[button.titleLabel setShadowOffset:CGSizeMake(5.0f, 5.0f)];

[self.view addSubview:button];

alt text http://img.skitch.com/20090825-xur3112ni5q2wrwwiix4jbcwc5.png

¿Estoy estableciendo la propiedad equivocada, o se trata de la forma en que estoy estableciendo shadowColor que está mal?

Gracias.

¿Fue útil?

Solución

¿Has probado:

[button setTitleShadowColor:[UIColor blueColor] forState:UIControlStateNormal];
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top