我正在尝试将我的 iOS 应用程序更新为暗模式,但在代码中设置暗模式颜色时遇到问题。在编辑 UITextView 时,我希望文本颜色在深色模式下为白色,在浅色模式下为黑色(这是默认标签颜色),但据我所知,我不知道如何在代码中编写它,我该怎么做做吗?
extension AddCardsVC: UITextViewDelegate {
func textViewDidBeginEditing(_ textView: UITextView) {
if #available(iOS 13.0, *) {
definitionInput.textColor = UIColor.(need default label color)
} else {
definitionInput.textColor = UIColor.black
}
if(definitionInput.text == "organizing items into familiar, manageable units; often occurs automatically"){
definitionInput.text = ""
}
}
}
最佳答案
或使用 UIColor.label
获取系统标签颜色。
关于ios - 如何根据暗/亮模式设置默认标签颜色(在 Swift 中),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59976099/