Это из другого переполнения стека, но, похоже, работает нормально. Post found here.
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Dont care what goes here, since we're about to change below" message:@"" preferredStyle:UIAlertControllerStyleActionSheet];
NSMutableAttributedString *hogan = [[NSMutableAttributedString alloc] initWithString:@"Presenting the great... Hulk Hogan!"];
[hogan addAttribute:NSFontAttributeName
value:[UIFont systemFontOfSize:50.0]
range:NSMakeRange(24, 11)];
[alertVC setValue:hogan forKey:@"attributedTitle"];
UIAlertAction *button = [UIAlertAction actionWithTitle:@"Label text"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action){
//add code to make something happen once tapped
}];
UIImage *accessoryImage = [UIImage imageNamed:@"someImage"];
[button setValue:accessoryImage forKey:@"image"];
Чтобы изменить цвет текста со следующими, добавляя его до установки линии [alertVC SetValue: Хоган forKey: @ "attributedTitle"];
[hogan addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0,35)];
возможный дубликат [UIAlertController пользовательского шрифта, размер, цвет] (HTTP: // StackOverflow. com/questions/26460706/uialertcontroller-custom-font-size-color) – picciano
проверить это решение http://stackoverflow.com/a/27518769/2050181 –
проверить это решение http://stackoverflow.com/questions/26460706/uialertcontroller -custom-font-size-color/41299305 # 41299305 –