• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

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

[复制链接]
菜鸟教程小白 发表于 2022-12-11 18:17:53 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

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

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

- (void)setCheckedBOOL)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) collectionViewUICollectionView *)cv didSelectItemAtIndexPathNSIndexPath *)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;
    }


}



Best Answer-推荐答案


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

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

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

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap