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 文本字体大小和颜色


- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01