当文本设置为“属性"时,带有自定义字体的 UITextView 不起作用 [英] UITextView with custom font not working when text set to "attributed"

查看:41
本文介绍了当文本设置为“属性"时,带有自定义字体的 UITextView 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UITextView 带有一些来自 .rtf 的文本(直接粘贴到 Xcode 上)

I have a UITextView with some text that came from a .rtf (pasted directly onto Xcode)

上下文仅包含一种自定义字体(Futura Book BT 11.0)

The context contain only one custom font (Futura Book BT 11.0)

如果我将text(attributed)"属性设置为plain"=自定义字体从故事板和应用程序中正确显示

If I set the "text(attributed)" property to "plain"= The custom font appear properly from the storyboard and from the app

如果我将text"属性设置为attributed"=.自定义字体从情节提要中正确显示,但不能从应用程序中正确显示.

If I set the "text" property to "attributed"=. The custom font appear properly from the storyboard BUT not from the app.

由于我的目标是使用多种字体的文本,如何让属性与自定义字体一起使用?(斯威夫特)

As my goal was to have a text with multiple font working, how to have the attributed property to work with custom fonts? (Swift)

谢谢!

推荐答案

自定义字体在故事板中正确显示,但在应用中显示不正确.

The custom font appear properly from the storyboard BUT not from the app.

应用程序根本不显示字体,还是恢复到系统字体?如果它恢复到 Helvetica,看起来这可能是 iOS 8.1 中的一个已知错误http://openradar.appspot.com/radar?id=5117089870249984

Does the app not show the font at all, or does it restore to system font? If it is reverting to Helvetica, it looks like this may be a known bug in iOS 8.1 http://openradar.appspot.com/radar?id=5117089870249984

可能的解决方案:你在模拟器和设备上测试过吗?可能是它在模拟器上不起作用,这意味着您可以通过在系统上安装字体来修复它.

Possible Solution: Did you test it on the simulator and a device? It could be that it just doesn't work on the simulator, which means you could fix it by installing the font on your system.

这篇关于当文本设置为“属性"时,带有自定义字体的 UITextView 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆