ios - BottomBar BarButtonItem Voice Over 辅助功能已损坏

标签 ios objective-c accessibility uibarbuttonitem voiceover

我注意到当 BarButtonItems 被放置在 View 的底部栏中时,标准画外音行为存在一些问题。

在测试应用程序中,我制作了以下简单 View

Test App Showing Top Bar, Bottom Bar button items and a label

使用以下代码,我将更新所有 3 个文本元素,以便它们每秒计数。

@interface ViewController ()

@property (weak, nonatomic) IBOutlet UILabel *testLabel;
@property (weak, nonatomic) IBOutlet UIBarButtonItem *testBarButtonItem;
@property (weak, nonatomic) IBOutlet UIBarButtonItem *testBottomBarItem;

@property (nonatomic, strong) NSTimer *timer;
@property (nonatomic) NSInteger count;

@end

@implementation ViewController

- (void)viewDidLoad
{
  [super viewDidLoad];
  // Do any additional setup after loading the view, typically from a nib.

  self.count = 0;
  self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(updateTimer:) userInfo:nil repeats:YES];

  // run the timer for the common modes so it's not interrupted with scrolling - should be ticked in pretty much all modes now
  [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes];

  self.testLabel.accessibilityTraits |= UIAccessibilityTraitUpdatesFrequently;
  self.testBarButtonItem.accessibilityTraits |= UIAccessibilityTraitUpdatesFrequently;
  self.testBottomBarItem.accessibilityTraits |= UIAccessibilityTraitUpdatesFrequently;
}

-(void)updateTimer:(NSTimer*)theTimer
{
  self.testLabel.text = [NSString stringWithFormat:@"Label with value %d", (int)self.count];
  self.testBarButtonItem.title = [NSString stringWithFormat:@"Top Item with title %d", (int)self.count];
  self.testBottomBarItem.title = [NSString stringWithFormat:@"Bottom Item with title %d", (int)self.count];
  self.count++;
}

在启用 Voice Over 的情况下在我的 iPhone 6+ 上测试此应用,出现以下情况

  • 顶部栏按钮项目在更新其内容时闪烁
  • 由于设置了 UIAccessibilityTraitUpdatesFrequently 特征,顶部栏按钮项正确读出其更新的内容
  • 由于设置了 UIAccessibilityTraitUpdatesFrequently 特性,位于中心的 Label 正确读出其更新的内容
  • 底部栏按钮项目没有正确读出其更新的内容,即使它也具有 UIAccessibilityTraitUpdatesFrequently 特征集
  • 当从顶部栏按钮项开始通过左/右滑动导航辅助功能元素时,选择通过右滑动正确地向下移动到标签,但是从那里右滑动将选择带到 View 的左上角(其中没有控制权)。然后它会读出初始底部栏按钮内容“Bottom Item With title 0”,而不管底部按钮实际读取的是什么。只有在主动选择底部栏项目时,它才会真正正确地选择并读出它。但是正如已经描述的那样,它不会继续读出它

我认为导航错误可能是 iOS 8.4 中的新错误,因为我在我的主应用程序中没有注意到它,我已经进行了很长时间的语音测试,但我可能只是错过了它。

我在自己的应用程序中使用 UIAccessibilityTraitUpdatesFrequently 并没有取得多大成功,但我看到其他应用程序似乎可以正确使用它。因此,如果有人能指出我做错的事情,那就太好了。否则我想我会记录一个雷达错误。

作为引用,我现在将整个项目作为 zip 文件提供下载 here

这里有一个关于这个错误的视频

https://youtu.be/QokQ0MDGyZM

最佳答案

您似乎误解了 UIAccessibilityTraitUpdatesFrequently 的作用。它不能确保您的内容在动态变化时被读出。它的存在是为了确保过于冗长的内容(如计时器)不会在每次更新时都被读出。例如,如果您要将焦点放在每秒更新一次的计时器上。 VoiceOver 会读出

1 2个 3个 4个 ...

但是,让我们说这是一个时间。所以它必须读出:

1 小时 20 分 55 秒 1小时20分56秒 ...

但是,当它读完整个第一个公告“... 55 秒”时,计时器现在实际读数为 1:21:00。然而它仍然读出“... 56秒”,然后继续读出“... 57秒”,同时计时器和实际通知越来越不同步。

如果 VoiceOver 没有关注它,没有什么会自动读出自动更新的内容。这会造成严重破坏和许多可访问性问题。开发人员可以通过适当发布以下三个辅助功能通知来通知 VoiceOver 动态更改:

UIAccessibilityLayoutChangedNotification
UIAccessibilityScreenChangedNotification
UIAccessibilityAnnouncementNotification

请注意,这些行为在您的典型测试环境中有点不稳定。特别是我发现,你想确保在打开你的应用程序之前打开了 VoiceOver。在您的应用程序启动时使用快速切换快捷方式是在通知系统中阻止 VoiceOver 的好方法。更好的方法是打开 VoiceOver,重新启动手机,并在测试时保持打开状态。

关于ios - BottomBar BarButtonItem Voice Over 辅助功能已损坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31195503/

相关文章:

iphone - JSONKit 在从 iPhone 中的 Web 服务解码 JSON 对象时更改浮点值

ios - 在 Xcode 中使用 Swift 包管理器

iphone - 为什么要创建一个变量而不是直接赋值?

ios - 自动释放池 block

iOS 10 错误? NSDate 小时描述与日本地区和 24 小时休假

html - 辅助功能:使用媒体查询隐藏文本

iOS 相当于 Ruby VCR Cassettes/recording server http response iOS

iphone - float 只打印整数?

iphone - 将 VoiceOver 推进到移动 Safari 中的指定元素

javascript - 具有 508 可访问性的 Angular 2