点按或按住字体图标时的问号 [英] Question mark when tapping or holding font icons

查看:123
本文介绍了点按或按住字体图标时的问号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我最近开始对我的应用程序进行了一些修补,以使其与iOS 11兼容.值得庆幸的是,大多数似乎是这样.

So I recently started some tinkering with my app to get it iOS 11 compatible. Thankfully most of it seems to be.

但是我确实注意到,如果我点击工具栏上的,或者点击并按住图标(由fontello的ttf文件提供),则会出现一个问号框.

However I did notice, that in my toolbar if I tap or tap and hold an icon, which is supplied by a ttf file from fontello, I get a question mark box.

图标示例:

    menu = [[UIBarButtonItem alloc] initWithTitle:@"\ue811" style:UIBarButtonItemStylePlain target:self action:@selector(openMenu:)];
    [menu setTitleTextAttributes:@{NSFontAttributeName:
                                       [UIFont fontWithName:@"fontello"
                                                       size:23],
                                   NSForegroundColorAttributeName:[[UIColor alloc] initWithWhite:1.f alpha:1.f]}
                        forState:UIControlStateNormal];

在10.3.1模拟器中可以正常工作.只是iOS 11似乎被搞砸了.我已经阅读了有关设备的修补程序,这意味着要更新操作系统,但是模拟器正在运行11.2,因此从理论上讲应该予以修复.

It works fine in the 10.3.1 simulator. Just iOS 11 seems to be goofed up. I've read about the fixes for devices, which means to update the OS, but the simulator is running 11.2, so in theory it should be fixed.

还有其他人遇到这个问题吗?知道解决办法吗?

Is anybody else having this issue? Know of a fix?

推荐答案

只需为 UIControlStateSelected 添加标题文本属性,

Just add title text attributes for UIControlStateSelected also:

[menu setTitleTextAttributes:@{NSFontAttributeName:
                                  [UIFont fontWithName:@"fontello"
                                                  size:23],
                              NSForegroundColorAttributeName:[UIColor greenColor]}

forState:UIControlStateSelected];

forState:UIControlStateSelected];

这篇关于点按或按住字体图标时的问号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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