gpt4 book ai didi

ios - 如何更改标题和 alertController 的字体和颜色?

转载 作者:行者123 更新时间:2023-11-28 07:03:13 24 4
gpt4 key购买 nike

我想知道有什么方法可以更改标题的字体和颜色 enter image description here (标题本身和后退按钮)和 alertController enter image description here

swift ?

最佳答案

code 下使用 KVC 适用于 ios8

   UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Title label" message:@"" preferredStyle:UIAlertControllerStyleActionSheet];
NSMutableAttributedString *hogan = [[NSMutableAttributedString alloc] initWithString:@"Testing text"];
[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"];

关于ios - 如何更改标题和 alertController 的字体和颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31516165/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com