Donc j'ai une application qui a un UIAlertView personnalisé (par coutume, je veux dire ajouter UILabel en bas par programme). Cela fonctionne très bien sur iOS < 11, mais dans iOS 11, il échoue lamentablement. Donc, sur iOS 10 ça marche bien (à gauche) mais ça échoue dans iOS 11 (à droite) avec le même code bien sûr iOS 11 UIAlertView personnalisé ne rend pas très bien
Et c'est le code que j'utilise pour faire le UAlertView personnalisé. Des idées?
SessionManager *sessionMgr = [SessionManager sharedManager];
NSString *saludoStr = [NSString stringWithFormat:@"¡Bienvenido %@!",self.datosPersonalesResponse.nombre];
NSString *mailStr = [sessionMgr getUserEmail];
NSString *mensajeStr = [NSString stringWithFormat:@"Te hemos enviado un email de \nactivación de cuenta a: \n\n%@\n\nActivá tu cuenta para recibir alertas,\n avisos recomendados y postularte a \nempleos.\n",mailStr];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:saludoStr message:@"" delegate:self cancelButtonTitle:@"Cerrar" otherButtonTitles:@"No lo recibí", nil];
UILabel *lbl = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
lbl.numberOfLines= 0;
[lbl setFont:[UIFont fontWithName:@"OpenSans" size:13]];
[lbl setTextColor:[UIColor colorWithRed:146/255.0f green:146/255.0f blue:146/255.0f alpha:1.0]];
NSMutableAttributedString *attributedStr = [[NSMutableAttributedString alloc] initWithString:mensajeStr];
[attributedStr addAttribute:NSFontAttributeName
value:[UIFont fontWithName:@"OpenSans-Semibold" size:16]
range:NSMakeRange(56,[mailStr length])];
[attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(56,[mailStr length])];
lbl.attributedText = attributedStr;
lbl.textAlignment = NSTextAlignmentCenter;
[alert setValue:lbl forKey:@"accessoryView"];
[alert show];
'UIAlertView' n'a jamais pris en charge la possibilité d'ajouter des vues personnalisées. Cela a peut-être marché dans le passé, mais la documentation a toujours dit de ne pas le faire. – rmaddy