菜鸟教程小白 发表于 2022-12-11 18:17:53

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


                                            <p><p>我是 iOS 新手。我制作了包含语音功能的应用程序。我的应用由表格 View 中的<strong> Collection View </strong>组成。该应用程序有复选框(??没有按钮只是图像)并显示选中/未选中状态。 <br/>
<br/>当我选中复选框然后配音阅读此内容时。 -> ;
<br/>我第一次尝试时正确的操作(语音朗读),但是,<strong>第二次后语音朗读反转</strong>。
<br/> 如何修改我想要操作的代码。
<br/> 下面附上我的代码。
<br/>=========================第一个函数=================== ======</p>

<pre><code>- (void)setChecked:(BOOL)checked {
NSLog(@&#34;%s, checked = %d&#34;, __func__, _checked);
NSLog(@&#34; checked : %d&#34;, checked);
// Save property value
_checked= checked;

// Update checkbox image
NSString * filename;

if(checked)
{
    filename = [] pathForResource:@&#34;check_on&#34; ofType:@&#34;png&#34;];
    ;

}
else
{
    filename = [] pathForResource:@&#34;check_off&#34; ofType:@&#34;png&#34;];
    ;
}

];

NSLog(@&#34; self.checkBoxImageView setImage:[UIImage&#34;);
self.checkBoxImageView.frame = CGRectMake(12, 12, 50/2, 50/2);
NSLog(@&#34; self.checkBoxImageView.frame = CGRectMake&#34;);
}
</code></pre>

<p>==========================另一个函数==================== =====<br/></p>

<pre><code>- (void) collectionView:(UICollectionView *)cv didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@&#34;%s&#34;, __func__);
    NSLog(@&#34;%@&#34;, indexPath.description);

    //;
    //// Get selected cell
    //MYCell* cell = (MYCell*) ;

    ;
    // Get selected cell
    MYCell* cell = (MYCell*) ;

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

    // Check if set contains selected cell indexPath
    if()
    {
      // User tapped on checked cell
      // Remove selected indexPath from set
      ;

      // Uncheck checkbox on cell
      cell.checked = NO;
    }
    else // User tapped on unchecked cell
    {
      // Add selected indexPath to set
      ;

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


}
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>辅助功能提示旨在提供有关元素功能的额外信息。因此,配音系统假定内容将大部分保持静态(除非页面布局发生变化)。另请注意,即使在旁白模式开启时,许多用户也会将其关闭。</p>

<p>在这种情况下您应该设置的属性是 <code>accessibilityValue</code> ( <a href="https://developer.apple.com/documentation/objectivec/nsobject/1615117-accessibilityvalue" rel="noreferrer noopener nofollow">Apple doc</a> )。这用于元素中的动态内容,例如 UITextField 中的文本。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 是否有通过 api 获得延迟焦点状态的语音?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/45115612/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/45115612/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 是否有通过 api 获得延迟焦点状态的语音?