iOS 和 unicode 字符:\u+2605 在 UILabel 中不是实心星

iOS and unicode characters: \u+2605 not solid star in UILabel

我正在尝试制作一个显示“★ FEATURED”的 UILabel。然而,当它渲染它时,星星并不是实心的!这是我正在使用的代码:

    _sponsoredLabel = [UILabel new];
    _sponsoredLabel.numberOfLines = 1;
    _sponsoredLabel.lineBreakMode = NSLineBreakByTruncatingTail;
    _sponsoredLabel.textColor = [UIColor yellowColor];
    _sponsoredLabel.backgroundColor = [UIColor clearColor];
    _sponsoredLabel.textAlignment = NSTextAlignmentLeft;
    _sponsoredLabel.text = @"✭ FEATURED";
    _sponsoredLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:14.0f];
    _sponsoredLabel.hidden = YES;

在文本中它看起来很稳固,但这是它呈现时的样子:

非常感谢任何建议!

不同的字体代表不同的字形 - 这就是字体 的含义。如果您不喜欢 HeveticaNeue-Light 表示此字形的方式,请找到一种以您喜欢的方式表示它的字体。

问题是你的文字字符不是\u2605。是\u272D——勾勒黑星。您输入文字时输入了错误的字符。

这很好奇,您是否尝试过使用@"\u2605 FEATURED" 来查看您输入的那个是否有什么不同?

Unicode 字符有名称,而 2605 是 "Black Star."(参见 http://www.fileformat.info/info/unicode/char/2605/index.htm),因此您很可能只是在代码中输入了其他内容。