如何编辑UIAlertAction文本字体大小和颜色 [英] How to edit UIAlertAction text font size and color
问题描述
如何编辑 UIAlertAction
文字大小和颜色?我已经采取了 UIAlertController
,根据它如何编辑大小。这个我的代码
How to edit UIAlertAction
text size and color? I have taken a UIAlertController
acoording to it how to edit the size. This i smy Code
UIAlertController *controller = [UIAlertController alertControllerWithTitle:@"Do you wish to logout?" message:@"" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *logOut = [UIAlertAction actionWithTitle:@"Log Out" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {}];
现在我希望我的'Log Out'文本字体大小为22,绿色和半文字。
Now i want my 'Log Out' text with font size 22 and green color and in semibold.
推荐答案
您可以使用
UIAlertAction *myGoalAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"My Title", @"My Title")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action)
{
}];
[myGoalAction setValue:[UIColor greenColor] forKey:@"titleTextColor"];
没有有效的方法来更新字体大小。我建议你使用标准字体大小。
There is no efficient way to update font size.I will suggest you to use standard font size.
UIAlertAction标题标签是私有变量,无法直接访问。 Label位于3级私有视图层次结构中。显示更大字体的注销操作对app有意义。
UIAlertAction title label is private variable and not accessible directly. Label comes inside 3 level private view hierarchy. Showing logout action with bigger font make sense for app.
有许多开源解决方案可供使用。我建议您尝试此
There are many open source solution available.I will recommend to try this
这篇关于如何编辑UIAlertAction文本字体大小和颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!