Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/116.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 斯威夫特:如何在邮件文本中将字体更改为Courier?_Ios_Iphone_Ipad_Swift5 - Fatal编程技术网

Ios 斯威夫特:如何在邮件文本中将字体更改为Courier?

Ios 斯威夫特:如何在邮件文本中将字体更改为Courier?,ios,iphone,ipad,swift5,Ios,Iphone,Ipad,Swift5,我想以邮件的形式发送一个带有伪表(用空格填充的列)的文本。但是用标准字体看起来很糟糕——所有的行都有不同的长度。当我在调试器中查看文本时,它看起来很好:所有行都有80个字符长。如何使用“attributedString”?或者如何将字体更改为“Courier”,使所有行看起来长度相同? 在文本视图中,“Courier”字体很好 let picker = MFMailComposeViewController() picker.mailComposeDelegate

我想以邮件的形式发送一个带有伪表(用空格填充的列)的文本。但是用标准字体看起来很糟糕——所有的行都有不同的长度。当我在调试器中查看文本时,它看起来很好:所有行都有80个字符长。如何使用“attributedString”?或者如何将字体更改为“Courier”,使所有行看起来长度相同? 在文本视图中,“Courier”字体很好

        let picker = MFMailComposeViewController()
        picker.mailComposeDelegate = self

        if let subjectText = self.subject {
            picker.setSubject(subjectText)
        }
        picker.setMessageBody(self.body     , isHTML: false)

        self.present(picker, animated: true, completion: nil)
谁能帮我?谁知道如何更改邮件的字体?
提前感谢任何能提供帮助的人。

isHTML
转换为
true
,并将
self.body
嵌入HTML标记中,在该标记中将字体设置为Courier。例如:
picker.setMessageBody(“

\(self.body)

,isHTML:true)
`将
isHTML
转换为
true
,并将
self.body
嵌入HTML标记中,将字体设置为Courier。例如:
picker.setMessageBody(“

\(self.body)

”,isHTML:true)
`