自定义UITableViewCell可访问性 [英] Custom UITableViewCell accessibility
问题描述
如何单独设置UITableViewCells子视图的可访问性。
它不应该作为完整单元格访问?
How can you set the accessibility of subviews of UITableViewCells individually.
It should not be accessible as complete cell?
推荐答案
如果您的tableview单元格仅包含文本,则启用单元格的可访问性将会读取整个单元格。如果你有其他对象和按钮,建议使用 UITableViewCell
的子类,并覆盖 -accessibilityElements
方法返回所有可访问的元素。
If your tableview cell consists of text only, enabling accessibility for the cell will do and it will read out the whole cell. If you have other objects and buttons, it is recommended to use a subclass of UITableViewCell
and override the -accessibilityElements
method to return all your accessible elements.
部分代码:
#import "CustomCell.h"
@implementation CustomCell
- (void)awakeFromNib
{
self.accessibilityElements = @[self.view1, self.label, self.imageView];
}
以下帖子可能有所帮助:
Following post may help:
http://cocoacaffeine.wordpress.com/ 2013/11/29 /小巧可访问性/
这篇关于自定义UITableViewCell可访问性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!