Je dois personnaliser la couleur d'arrière-plan de l'UIAlertView.iphone UIAlertView - couleur d'arrière-plan personnalisée
J'ai un exemple de code qui fonctionne parfaitement sur iphone 3.x, mais sur l'iphone 4, alertview affiche la couleur bleue par défaut.
UIAlertView *alertView =
[[[UIAlertView alloc] initWithTitle:@"Alerta"
message:msg
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] autorelease];
[alertView show];
UILabel *theTitle = [alertView valueForKey:@"_titleLabel"];
[theTitle setTextColor:[UIColor redColor]];
UILabel *theBody = [alertView valueForKey:@"_bodyTextLabel"];
[theBody setTextColor:[UIColor whiteColor]];
UIImage *theImage = [UIImage imageNamed:@"Background.png"];
theImage = [theImage stretchableImageWithLeftCapWidth:0 topCapHeight:0];
CGSize theSize = [alertView frame].size;
UIGraphicsBeginImageContext(theSize);
[theImage drawInRect:CGRectMake(0, 0, theSize.width, theSize.height)];
theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[[alertView layer] setContents:(id)theImage.CGImage];
[alertView show];