我的表格 View 中的第一个单元格是一个虚拟单元格,因此,当画外音模式打开时,我想跳过那个单元格,这样焦点就不会出现在那个控件上
因此,画外音没有说出它的任何特征。我写了下面粘贴的代码来实现相同的目的,认为仅 isAccessibilityElement
就足够了。但似乎并非如此。
尽管我说这个元素在代码中是不可访问的,但在 Voice-over
模式下它仍然通过右/左轻弹获得焦点。关于如何实现这一点有什么想法吗?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
....
UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if(indexPath.row == 0)
{
cell.isAccessibilityElement = 0;
}
}
最佳答案
使用一些自定义单元格,并在该单元格定义中实现:
- (NSInteger)accessibilityElementCount {
NSIndexPath *indexPath = [(UITableView *)self.superview indexPathForCell: self];
if(indexPath.row==0){
return 0;
}
else{
return 1;
}
}
关于ios - 为表格 View 中的单元格而不是其他单元格关闭画外音焦点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13138319/