OGeek|极客世界-中国程序员成长平台

标题: 具有可访问性的 iOS 7 UIBarButtonItem [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 07:56
标题: 具有可访问性的 iOS 7 UIBarButtonItem

我试图在导航栏中给我的 barbuttonitem 一个 VoiceOver 可以读取的值,而不是读取 imgname。

我试过了,但它不起作用:

self.barBtnAbout.accessibilityLabel = NSLocalizedString(@"about", nil);
self.barBtnAbout.accessibilityHint = NSLocalizedString(@"about", nil);

有什么好主意吗?

亲切的问候!



Best Answer-推荐答案


我使用以下方法完成了此操作:

UIView *view = (UIView*)self.navigationItem.leftBarButtonItem;
[view setIsAccessibilityElement:YES];
[view setAccessibilityLabel:NSLocalizedString(@"about", @"")];
[view setAccessibilityHint:NSLocalizedString(@"about", @"")];

关于具有可访问性的 iOS 7 UIBarButtonItem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23800764/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4