归因于UITextView不适用于韩文符号 [英] Attributed UITextView doesn't work with Korean symbols

查看:82
本文介绍了归因于UITextView不适用于韩文符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

带属性的UITextView不适用于韩文符号.重现步骤:

Attributed UITextView doesn't work with Korean symbols. Steps to reproduce:

  • 将UITextView添加到表单中.
  • 使用以下代码:
NSDictionary *attributes = @{
    NSFontAttributeName:[UIFont fontWithName:@"HelveticaNeue" size:15], 
    NSForegroundColorAttributeName:[UIColor blackColor]};
[textView setAttributes:attributes
    range:NSMakeRange(0, textView.text.length)];

  • 运行该应用程序,在韩语(에서보냄)上键入任何文本,然后点击或按Enter.
  • 韩语文本将消失或被多个垃圾桶符号代替.为什么?我该如何解决?

    The Korean text will disappear or will be replaced by several trash symbols. Why? How can I fix it?

    P.S.对于以下问题,这是一个有趣的答案: UITextField文本每次其他击键都消失但是我正在代码上创建UITextView对象.

    P.S. The is an interesting answer on the question UITextField text disappears on every other keystroke But I'm creating UITextView object on the code.

    推荐答案

    以下不正确代码可以正常工作:

    The following incorrect code works fine:

    NSDictionary *attributes = @{
        NSFontAttributeName:[/*UIFont fontWithName:@"HelveticaNeue" size:15],*/
        NSForegroundColorAttributeName:[UIColor blackColor]};
    [textView addAttributes:attributes
        range:NSMakeRange(0, textView.text.length)];
    

    这篇关于归因于UITextView不适用于韩文符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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