具有重选标记字符的IOS 5.1 UILabel会忽略TextColor [英] IOS 5.1 UILabel with Heavy Check Mark character ignores TextColor

查看:95
本文介绍了具有重选标记字符的IOS 5.1 UILabel会忽略TextColor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在开发iOS应用程序,最近升级"到了xCode 4.3.1和iOS 5.1模拟器,并且只有一个字符有一个非常奇怪的问题.它在字符查看器中被称为"Heavy Check Mark",在我的应用程序5.0.1及更低版本中看起来很棒,并以.textColor = [UIColor redColor]进行着色.在5.1中,它在模拟器中显示为黑色,并且由于我的手机已越狱,因此我没有在实际设备上的5.1中对其进行检查.如果我输入任何其他字符,它将显示为红色,但是该特定字符始终显示为黑色.如果我在其前面放一个空格,它将显示为红色,但由于使用图层边框,因此该间距不正确.下面是实际的代码,但是我尝试了一个更简单的标签,并且遇到了同样的问题.

I've been developing an iOS app and recently "upgraded" to xCode 4.3.1 and the iOS 5.1 simulator and have a very strange issue with just one character. It's called "Heavy Check Mark" in the character viewer and it looks great in my app in 5.0.1 and below and is colored with a .textColor = [UIColor redColor]. In 5.1 it shows up black in the simulator and since my phone is jailbroken I haven't checked it in 5.1 on an actual device. If I put in any other character it shows up red, but this one specific character always shows black. If I put a space before it it shows up red but the spacing is off as I'm using a layer to border. Below is actual code, but I've tried a simpler label and have the same issue.

        isChecked = [[[UILabel alloc] initWithFrame:CGRectMake(20.0,9.0,20,20)] autorelease];
        isChecked.font = [UIFont boldSystemFontOfSize:24.0];
        isChecked.backgroundColor = [UIColor clearColor];
        isChecked.textColor = [UIColor redColor];
        isChecked.layer.borderColor = [UIColor blackColor].CGColor;
        isChecked.layer.borderWidth = 2.0;
        isChecked.text = @"✔";
        isChecked.tag = 2;
        [cell.contentView addSubview:isChecked];

还有其他人遇到这个或其他特殊字符和UILabel.textColor问题吗?有建议的解决方法吗?我尝试临时删除该图层,甚至创建一个新的最小标签,如果仅此字符,则结果为黑色,如果有其他字符,则设置为红色.

Anyone else experiencing problems with this or other special characters and UILabel.textColor? Any suggested workarounds? I've tried temporarily removing the layer and even creating a new minimal label and same results black if this character only and red as set if any other.

推荐答案

更新并修复适合我的方法,但仍然很奇怪.如果还有其他人遇到这个晦涩的问题,我发现使用命名字体而不是系统字体似乎可以解决此问题.

Update and fix that works for me, but still very strange. If anyone else ran into this obscure issue I found that using a named font instead of system font seems to fix it.

这篇关于具有重选标记字符的IOS 5.1 UILabel会忽略TextColor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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