ios - 是否有获得延迟焦点状态的 api 语音?

标签 ios objective-c

我是 iOS 新手。我正在制作包含语音功能的应用程序。我的应用程序包含来自表格 View 的 Collection View 。该应用程序有复选框(??没有按钮只是图像)并且显示选中/未选中状态。

当我选中复选框然后旁白阅读此内容时。 -> [self.checkBoxImageView setAccessibilityHint:@"~~~~"];
第一次尝试时操作正确(语音朗读),但第二次后语音朗读反转
如何修改以修复我想要操作的代码。
在下面附上我的代码。
=========================第一个函数=================== ======

- (void)setChecked:(BOOL)checked {
NSLog(@"%s, checked = %d", __func__, _checked);
NSLog(@"[D] checked : %d", checked);
// Save property value
_checked  = checked;

// Update checkbox image
NSString * filename;

if(checked)
{
    filename = [[NSBundle bundleForClass:[self class]] pathForResource:@"check_on" ofType:@"png"];
    [self.checkBoxImageView setAccessibilityHint:@"Checked"];

}
else
{
    filename = [[NSBundle bundleForClass:[self class]] pathForResource:@"check_off" ofType:@"png"];
    [self.checkBoxImageView setAccessibilityHint:@"Unchecked"];
}

[self.checkBoxImageView setImage:[UIImage imageWithContentsOfFile:filename]];

NSLog(@"[D] self.checkBoxImageView setImage:[UIImage");
self.checkBoxImageView.frame = CGRectMake(12, 12, 50/2, 50/2);
NSLog(@"[D] self.checkBoxImageView.frame = CGRectMake");
}

=========================另一个函数==================== =====

- (void) collectionView:(UICollectionView *)cv didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"%s", __func__);
    NSLog(@"%@", indexPath.description);

    //[collectionView deselectItemAtIndexPath:indexPath animated:YES];
    //// Get selected cell
    //MYCell* cell = (MYCell*) [collectionView cellForItemAtIndexPath:indexPath];

    [cv deselectItemAtIndexPath:indexPath animated:NO];
    // Get selected cell
    MYCell* cell = (MYCell*) [cv cellForItemAtIndexPath:indexPath];

//    if (cell.checked == NO)
//        cell.checked = YES;
//    else if (cell.checked == YES)
//        cell.checked = NO;

    // Check if set contains selected cell indexPath
    if([self.checkedIndexPaths member:indexPath])
    {
        // User tapped on checked cell
        // Remove selected indexPath from set
        [self.checkedIndexPaths removeObject:indexPath];

        // Uncheck checkbox on cell
        cell.checked = NO;
    }
    else // User tapped on unchecked cell
    {
        // Add selected indexPath to set
        [self.checkedIndexPaths addObject:indexPath];

        // Check checkbox on cell
        cell.checked = YES;
    }


}

最佳答案

辅助功能提示旨在提供有关元素功能的额外信息。因此,画外音系统假定内容大部分将保持静态(除非页面布局发生变化)。另请注意,许多用户即使在画外音模式打开时也将其关闭。

在这种情况下您应该设置的属性是 accessibilityValue ( Apple doc )。这用于元素中的动态内容,例如 UITextField 中的文本。

关于ios - 是否有获得延迟焦点状态的 api 语音?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45115612/

相关文章:

iOS swift,在UIView中调用touchesEnded时,storyboard中的presencetViewController其他xib或ViewController

iphone - scrollToRowAtIndexPath 不滚动到非事件/卸载的单元格

c++ - 使用 C++ 和 Objective C 从原始图像复制数据

ios - 在应用程序委托(delegate)中制作窗口 Root View Controller 时收到警告 "Presenting view controllers on detached view controllers is discouraged"?

objective-c - 如何覆盖 Storyboard中定义的 UIBarButtonItem 触发的 segue

ios - 使用新的 PageCurl 效果通过 MonoTouch 和 iOS 5.0 读取 PDF 时出现奇怪的崩溃

ios - 无法打开testflight构建

ios - 内存泄漏导致我的 GPUImage 相机应用程序崩溃

ios - 缺少 map ,仅可见标记

swift - 串行队列内的并发队列调用?