ran*_*onk 6 uitableview ios voiceover ios5
我有一个UITableViewController,我试图自定义节标题看起来更像纯文本.我发现当我向自定义headerView添加子视图(详见下文)时,它会破坏VoiceOver标题导航.
例如:假设我有一个包含三个标题的表:Header1,Header2,Header3.
如果没有viewForHeaderInSection方法的自定义实现,我可以切换画外音转子以按标题导航,一切都按预期工作.
当我以下面的方式实现viewForHeaderInSection方法时,我可以从Header1移动到Header2到Header3并返回到Header2,但是然后画外音丢失所有标题(说"找不到标题").
当我将headerLabel作为子视图添加到headerView时,我发现问题就出现了.我已经尝试将headerLabel设置为隐藏的辅助功能元素,因此画外音不会提取它,但问题仍然存在.
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0,0,tableView.frame.size.width,30)];
UILabel *headerLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, headerView.frame.size.width-120.0, headerView.frame.size.height)];
headerLabel.textAlignment = UITextAlignmentLeft;
headerLabel.font = [UIFont boldSystemFontOfSize:22];
headerLabel.text = [headersArray objectAtIndex:section];
headerLabel.backgroundColor = [UIColor clearColor];
[headerView addSubview:headerLabel];
return headerView;
}
Run Code Online (Sandbox Code Playgroud)
任何有关VoiceOver如此反应的想法都将受到赞赏.
谢谢.
小智 2
这不太可能是原始问题的答案,但我只是解决了类似的问题。
我为节标题定制了 UIView,并将这些内容保存在一个数组中,并偶尔重用它们。这完全混淆了 VoiceOvery,并且前进或后退并不总是导致按预期选择上一个或下一个单元格。
然而,当我每次调用 tableView:viewForHeaderInSection: 时都创建一个新的 UIView 时,VoiceOver 的这种导航混乱就停止了,并且一切正常。我的标题视图是可访问的(isAccessibleElement)并且有一个标签集。
| 归档时间: |
|
| 查看次数: |
2253 次 |
| 最近记录: |