【发布时间】:2017-03-23 07:59:00
【问题描述】:
let attrStr = try! NSAttributedString(
data: "Your baby in week three\n" +
"Three weeks into your pregnancy, and you might be wondering just how this little miracle occurred (as in the science bit we will assume you know the other part!). \n" +
"\n" +
"So here goes: the joining of your partner's sperm and your egg at the moment of conception resulted in a ball of cells (or a blastocyst, if you want to get really technical) which is now starting the 6 day journey from the fallopian tube to the uterus where it will attach itself to the lining of your womb and in nine months time, will result in a real live baby in your arms! \n" +
"\n" +
"Amazingly, although you will not know for a few months (or until the birth) the <b><font color=#00690c >sex of your baby</font></b> has already been determined. The fertilised egg contains <b><font color=#e3007b>46</font></b> chromosomes with <b><font color=#e3007b>23</font></b> from you and <b><font color=#e3007b>23</font></b> from the dad. You as mum will always provide the <b><font color=#e3007b>X</font></b> chromosome but the dad can provide an <b><font color=#e3007b>X</font></b> or <b><font color=#e3007b>Y</font></b> chromosome. <b><font color=#e3007b>XX</font></b> and you will be having a girl, <b><font color=#e3007b>XY</font></b> and you will have a little boy in 9 months time!".dataUsingEncoding(NSUnicodeStringEncoding, allowLossyConversion: true)!,
options: [ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType],
documentAttributes: nil)
trimestercontent.attributedText = attrStr
使用“+”运算符连接字符串的标题出现错误。 有什么方法可以解决这个问题,因为我有一个带有“+”运算符的批量数据来连接字符串。 请帮忙
【问题讨论】: