16
Sto provando a impostare il colore dell'ombra su un UIButton, ma tutto quello che riesco a ottenere è un grigio medio.Perché non posso impostare il colore dell'ombra del mio pulsante?
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
Am I impostando la proprietà sbagliato, o è il modo in cui sto impostando shadowColor
che c'è di sbagliato?
Grazie.
Perfetto, grazie. Mi stavo sbattendo la testa cercando di capire perché non funzionava. –
Esiste un modo per impostare anche l'offset dell'ombra? –
shadow offset funziona come previsto: [button.titleLabel setShadowOffset: CGSizeMake (5.0f, 5.0f)]; – Vassily