ios - 类型“NSAttributedStringKey”(又名“NSString”)没有成员“foregroundColor”
问题描述
以下是上述问题的代码行。此问题发生在Swift 4.1
.
let textAttributes = [NSAttributedStringKey.foregroundColor:UIColor.white]
navigationController?.navigationBar.titleTextAttributes = textAttributes
解决方案
我通过替换属性字符串的键解决了这个问题。
这是我更新的代码是:
let textAttributes = [NSForegroundColorAttributeName : UIColor.white]
navigationController?.navigationBar.titleTextAttributes = textAttributes
推荐阅读
- c++ - Boost Graph Library,修复节点大小
- arrays - Typescript - Check values in one array are present in another
- c# - WPF 设计器问题(mahapps Metro)?
- python - 在pandas python中逐列计算匹配部分字符串的出现次数
- python - LDA Mallet 替代 get_document_topics - 衡量每个文档的主题
- makefile - 在规则的配方部分使用 %(百分比通配符)
- c# - 将 JToken 转换为对象列表
- r - 将数据点 y 值分配给不同的 y_discrete 轴值 (ggplot)
- drupal - 在自定义模块中使用 drush 命令是否有风险?
- javascript - 如何在我的 Mongo 聚合查询中使用现有字段作为 $match 的修饰符