[英]How do I initialize an empty NSMutableAttributedString in swift?
有了這段代碼,它告訴我'String' is not convertible to 'NSMutableAttributedString'
var textViewString:NSMutableAttributedString = ""
如何正確將此字符串初始化為空? (當我遍歷將字符串追加到字符串的循環時,它必須為空。)
您可以這樣定義
var textViewString = NSMutableAttributedString(string: "")
您可以簡單地使用以下命令創建一個空的可變屬性字符串
var textViewString = NSMutableAttributedString()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.