如何编辑 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) {}];
现在我想要我的注销"文本,字体大小为 22,绿色,半粗体.
Now i want my 'Log Out' text with font size 22 and green color and in semibold.
你可以使用更新文本颜色
You can update text color using
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 标题标签是私有变量,不能直接访问.标签位于 3 级私有视图层次结构中.使用更大的字体显示注销操作对应用程序有意义.
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.
有很多开源解决方案可用.我会推荐尝试this
There are many open source solution available.I will recommend to try this
这篇关于如何编辑 UIAlertAction 文本字体大小和颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!