VoiceOver导航控制器中后退按钮的AccessibilityHint

时间:2015-04-14 09:34:39

标签: ios accessibility voiceover

有没有办法为后退按钮设置accessibilityHint? 我希望首先阅读配音

“后退按钮”,在此提示之后,例如 “双击以返回选择建筑物屏幕”

我正试图这样做,但它不起作用:

在viewDidLoad中:

[super viewDidLoad];
// back button without any text just back arrow
UIBarButtonItem *backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@""
                                                                      style:UIBarButtonItemStylePlain
                                                                     target:nil
                                                                     action:nil];

self.navigationItem.backBarButtonItem = backBarButtonItem;
self.navigationItem.backBarButtonItem.accessibilityHint = @"Double tap to go back to select a building screen";

2 个答案:

答案 0 :(得分:0)

只需设置可访问性标签,而不是可访问性提示。

self.navigationItem.backBarButtonItem.accessibilityLabel = @“后退按钮,双击返回以选择建筑物屏幕”;

答案 1 :(得分:0)

使用backBarButtonItem代替使用leftBarButtonItem应该是诀窍。

在显示后退按钮的视图控制器中尝试以下代码:

override func viewDidLoad() {
    super.viewDidLoad()

    let myBackButton = UIBarButtonItem(image: UIImage(named: "chevron"), 
                                       style: .done, 
                                       target: self, 
                                       action: #selector(goBackToThePreviousView(info:)))

    myBackButton.accessibilityLabel = "this is the back button"
    myBackButton.accessibilityHint = "this is my personal hint"

    self.navigationItem.leftBarButtonItem = myBackButton
}

现在,您后退按钮只有一个箭头,并且可以添加任何所需的辅助功能标签或提示