问题描述
如何编辑 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 文本字体大小和颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)