我正在使用属性文本来编辑文本中的字符串样式。在故事板中,它显示我想要的。但是当我尝试将应用程序运行到模拟器设备时,看看结果是否正常但是属性文本没有显示。模拟器设备仅显示纯文本。如何让仿真器设备显示属性文本?
<!--View Controller-->
<scene sceneID="Hfg-vx-s6i">
<objects>
<viewController id="di3-Y9-W12" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="F6t-h3-SiZ"/>
<viewControllerLayoutGuide type="bottom" id="axk-bq-fyl"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="ph9-HP-KWx">
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" usesAttributedText="YES" translatesAutoresizingMaskIntoConstraints="NO" id="pNn-mb-lpY">
<rect key="frame" x="0.0" y="0.0" width="240" height="128"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<attributedString key="attributedText">
<fragment content="This is test and this suppose to be bold.">
<attributes>
<font key="NSFont" size="14" name="HelveticaNeue-Bold"/>
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
<fragment content="
">
<attributes>
<font key="NSFont" size="14" name="HelveticaNeue"/>
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
<fragment content="This is test and this suppose to be italic.">
<attributes>
<font key="NSFont" size="14" name="HelveticaNeue-Italic"/>
<font key="NSOriginalFont" size="14" name="HelveticaNeue-Italic"/>
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
<fragment content="
">
<attributes>
<font key="NSFont" size="14" name="HelveticaNeue"/>
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
<fragment content="This is test and this suppose to be regular.">
<attributes>
<font key="NSFont" size="14" name="HelveticaNeue"/>
<font key="NSOriginalFont" size="14" name="HelveticaNeue"/>
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
<fragment content="
Test Test Test">
<attributes>
<font key="NSFont" size="14" name="HelveticaNeue"/>
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
</attributedString>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
<variation key="heightClass=regular-widthClass=compact" fixedFrame="YES">
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<rect key="frame" x="0.0" y="0.0" width="400" height="800"/>
</variation>
</textView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<variation key="default">
<mask key="subviews">
<exclude reference="pNn-mb-lpY"/>
</mask>
</variation>
<variation key="heightClass=regular-widthClass=compact">
<mask key="subviews">
<include reference="pNn-mb-lpY"/>
</mask>
</variation>
</view>
</viewController>