UITextView - 在 XCode 5 上设置字体不适用于 iOS 6 [英] UITextView - setting font not working with iOS 6 on XCode 5

查看:29
本文介绍了UITextView - 在 XCode 5 上设置字体不适用于 iOS 6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的用户界面使用故事板.我之前使用过 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:),但这没有用.文本视图显示在故事板中设置的字体.我会在这里错过什么?是否有任何自动布局约束与此类事情混淆?我在迁移过程中遇到了一些约束问题,但正如我所说,字体在 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.

我想这是我缺少的 Storyboard 中的某些东西,就像我创建了一个 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.

我会提供一些代码,但我不确定它在这种情况下是否有帮助.

I'd put up some code, but I'm not sure it'd help at all in this case.

推荐答案

该问题是由 Storyboard 中的 editable 属性为 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屋!

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