iOS 11自定义UIAlertView不呈现罚款
问题描述:
所以我有和自定义UIAlertView应用程序(通过自定义我的意思是在底部以编程方式添加UILabel)。它在iOS < 11上运行得很好,但是在iOS 11中它失败了。因此,在iOS 10上它工作正常(左),但在iOS 11(右)中失败,使用相同的代码当然iOS 11自定义UIAlertView不呈现罚款
这是我用来制作自定义UAlertView的代码。有任何想法吗?
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'从来不支持添加自定义视图的能力。它可能在过去有效,但文档一直声明不这样做。 – rmaddy