Eli*_*ida 3 email nsattributedstring ios swift
如何通过电子邮件发送属性字符串?
mailComposerVC.setMessageBody(textView.attributedString, isHTML: false)
Run Code Online (Sandbox Code Playgroud)
您已将Attributed字符串转换为HTML字符串.使用以下代码生成html字符串.
do {
let data = try string.dataFromRange(NSMakeRange(0, string.length), documentAttributes: [NSDocumentTypeDocumentAttribute : NSHTMLTextDocumentType])
let htmlString = String(data: data, encoding: NSUTF8StringEncoding)
}catch {
}
Run Code Online (Sandbox Code Playgroud)
使用生成的html字符串作为
mailComposerVC.setMessageBody(htmlString, isHTML: true)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
714 次 |
| 最近记录: |