How to edit UIAlertAction text font size and color(如何编辑 UIAlertAction 文本字体大小和颜色)
问题描述
如何编辑 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 文本字体大小和颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何编辑 UIAlertAction 文本字体大小和颜色


基础教程推荐
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01