本文介绍了iOS辅助功能-如何设置UINavigationBar标题的辅助功能标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Apple的声音使我的其中一个视图的标题发音错误,该视图位于UINavigation控制器内部.

Apple's voice over mispronounces the title of one of my views, which is inside a UINavigation Controller.

在应用程序的其他部分,我添加了自定义可访问性标签,以帮助其正确发音公司名称.如何设置UINavigationBar的辅助功能标签?

In other parts of the app I have added a custom accessibility label to help it pronounce the company name correctly. How can I set the accessibility label of a UINavigationBar?

推荐答案

我无法添加辅助功能标签,但找到了解决方法:

I couldn't add an accessibility label, but I found a workaround:

我将UIItem的标题替换为具有可访问性的UILabel.

I replace the navigationItem's title View with a UILabel that has accessibility set up.

UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.text = @"myTitle";
[titleLabel setAccessibilityLabel:@"myCustomAccessiblityLabel"];
[titleLabel setFont:[UIFont boldSystemFontOfSize:20.0]];
[titleLabel setBackgroundColor:[UIColor clearColor]];
[titleLabel setTextColor:[UIColor whiteColor]];
[titleLabel sizeToFit];
self.navigationItem.titleView = titleLabel;

我不确定为什么设置可访问性标签不起作用,但是上面的代码可以满足我的需求.

I'm not sure why setting the accessibility label doesn't work, but the above code works for my needs.

这篇关于iOS辅助功能-如何设置UINavigationBar标题的辅助功能标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 16:55