ios - 未在 IOS 13 中附加的 NSMutableAttributedString 在 iOS 12 或更低版本中运行良好
问题描述
下面的代码在 iOS 12 或更低版本中运行良好,但在 iOS 13 中无法附加,因为它只打印First Line
并且无法打印Extra Text
。
let formattedString = NSMutableAttributedString()
formattedString.append(NSAttributedString(string: "First Line\n" ,
attributes:[NSAttributedStringKey.font:UIFont.systemFont(ofSize: 8.0), NSAttributedStringKey.foregroundColor : UIColor.white]))
formattedString.append(NSAttributedString(string: "Extra Text", attributes: [NSAttributedStringKey.foregroundColor : UIColor.white]))
self.setAttributedTitle(formattedString, for: .normal)
解决方案
推荐阅读
- debugging - gdb显示0xc0000142错误,它也没有运行,请帮帮我
- c# - 如何在 Word 文档中“标记”一段文本,以便使用 Interop.Word 轻松删除它
- css - 如何将@font-face 用于 Manrope 字体?
- javascript - 如何获得可重用的菜单组件?
- android - Android 单元测试 ViewModel 需要但未调用
- python-3.x - 让 OpenCV 的“不失真”更有效地运行的简单方法?
- python - 在 Pandas 中创建一个新列
- javascript - 苗条打字稿上的苗条自定义事件
- java - WSO2 - 将 java 类作为项目的一部分包含的正确方法是什么
- javascript - 如何从 list.stdout.on 方法中获取数据