UITextView - 在XCode 5上设置不适用于iOS 6的字体 [英] UITextView - setting font not working with iOS 6 on XCode 5
问题描述
我正在为我的UI使用故事板。我之前使用的是XCode 4.6并在iOS 6上发布。我已经使用XCode 5更新到iOS 7并更新了Storyboard以便与XCode 5很好地协作。我有一个问题:
I'm using storyboards for my UI. I was previously using XCode 4.6 and released on iOS 6. I have since updated to iOS 7 using XCode 5 and updated the Storyboard to work nicely with XCode 5. I have one issue though:
UITextView
不希望在代码中显示字体更改。文本颜色更改工作正常。任何其他财产变更都没问题。字体,完全没有。我使用的是自定义字体,因此我检查了不同大小的不同字体(即 systemFontOfSize:
),但这不起作用。文本视图仅显示在Storyboard中设置的字体。我在这里可以缺少什么?有没有任何自动布局约束混乱这种事情?我在迁移过程中遇到了一些约束问题,但正如我所说,iOS 7中的字体工作正常。
UITextView
doesn't want to display font changes within code. Text colour changes work fine. Any other property changes are fine. Font, not at all. I was using a custom font, so I checked different fonts with different sizes (i.e. systemFontOfSize:
) but that didn't work. The text view only shows the font that's set in the Storyboard. What could I be missing here? Are there any auto-layout constraints that mess with this sort of thing? I had a few issues with constraints during the migration, but as I said, the fonts work fine in iOS 7.
我想这是故事板里的东西我是缺少,好像我创建一个 UIViewController
并在代码中添加一个文本视图,它工作正常。
I guess it's something in the Storyboard that I'm missing, as if I create a UIViewController
and add a text view in code, it works fine.
我' d提出一些代码,但我不确定在这种情况下它会有什么帮助。
I'd put up some code, but I'm not sure it'd help at all in this case.
推荐答案
问题是由故事板中的可编辑
属性为false引起的。我完全不知道为什么这会导致字体保持不变 - 仅在iOS 6上。
The issue was caused by the editable
property being false in the Storyboard. I have absolutely no idea why this caused the font to remain unchanged - and only on iOS 6.
这篇关于UITextView - 在XCode 5上设置不适用于iOS 6的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!