OGeek|极客世界-中国程序员成长平台

标题: iOS画外音: Focus selected cell and not the first row [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 20:53
标题: iOS画外音: Focus selected cell and not the first row

我试图让我的应用程序可访问,在我的界面中我有一个 UILabel 和一个 UITableView,tableView 有一个 selectedRow。 selectedRow 是表格 View 中间的行,例如如果我有 100 行,则为第 50 行。

我的问题是当我在屏幕上滑动以转到下一个元素时,在这种情况下,当我从标签转到 tableView 时,焦点转到第一个索引而不是我的单元格。

我该如何解决这个问题?



Best Answer-推荐答案


假设您只有一个标签和一个表格 View ,问题归结为当您从标签移动到表格 View 时要记住单元格的最新位置。

以下算法可以用来解决这个问题:

enter image description here

看看UIAccessibilityFocus informal protocol处理可访问元素的焦点。

关于iOS画外音: Focus selected cell and not the first row,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53542890/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4