Изменение цвета в attributeMessage и attributeTitle не работает. Есть ли решение для этого? Хорошо работает на iOS 12, но больше не работает на iOS 13. Что можно сделать или есть решение или модификация?
Вот полный фрагмент:
NSString *title=NSLocalizedString(@"Title",nil);
NSString *message=NSLocalizedString(@"Message",nil);
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleActionSheet];
[alertController addAction:({
UIAlertAction *action0 = [UIAlertAction actionWithTitle:NSLocalizedString(@"Other1",nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action0) {
NSLog(@"OK1");
}];
[action0 setValue:[UIColor lightGrayColor] forKey:@"titleTextColor"];
action0;
})];
[alertController addAction:({
UIAlertAction *action = [UIAlertAction actionWithTitle:NSLocalizedString(@"Other2",nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
NSLog(@"OK2");
}];
[action setValue:[UIColor lightGrayColor] forKey:@"titleTextColor"];
action;
})];
[alertController addAction:({
UIAlertAction *action2 = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel",nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action2) {
}];
[action2 setValue:[UIColor orangeColor] forKey:@"titleTextColor"];
action2;
})];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setAlignment:NSTextAlignmentCenter];
NSMutableAttributedString *titleText;
titleText = [[NSMutableAttributedString alloc]
initWithString:title
attributes:@{NSParagraphStyleAttributeName: paragraphStyle,
NSFontAttributeName : [UIFont boldSystemFontOfSize:17],
NSForegroundColorAttributeName :[UIColor whiteColor]
}];
NSMutableParagraphStyle *paragraphStyle2 = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle2 setAlignment:NSTextAlignmentCenter];
NSMutableAttributedString *messageText;
messageText = [[NSMutableAttributedString alloc]
initWithString:message
attributes:@{NSParagraphStyleAttributeName: paragraphStyle2,
NSFontAttributeName : [UIFont boldSystemFontOfSize:14],
NSForegroundColorAttributeName : [UIColor lightTextColor]
}];
[alertController setValue:titleText forKey:@"attributedTitle"];
[alertController setValue:messageText forKey:@"attributedMessage"];
[self presentViewController:alertController animated:YES completion:nil];