ios - 自定义视图(如收藏视图)上的辅助功能旁白
问题描述
目前我正在研究自定义视图。
我需要在标准 UICollectioView 中实现 VoiceOver 的行为。当我将焦点从自定义视图层次结构之外的元素转换为层次结构中的元素时,VoitserOver 读取自定义视图的可访问性标签,然后读取所选视图的可访问性标签
@interface FBMinimizedPlayerControlPanelView ()
@property (nonatomic, strong) ImageView *artworkView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *subtitleLabel;
@property (nonatomic, strong) ImageContainer *togglePlayPauseButton;
@end
@implementation FBMinimizedPlayerControlPanelView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self setUp];
}
return self;
}
- (void)setUp {
// self.isAccessibilityElement = YES;
self.accessibilityLabel = @"Miniplayer.";
self.accessibilityHint = @"Double tap to expand the miniplayer.";
// self.accessibilityElementsHidden = YES;
//set up code
[self.togglePlayPauseButton configureWithAccessibilityLabel:@"Play" forState:BEToggleButtonStateSelected];
[self.togglePlayPauseButton configureWithAccessibilityLabel:@"Pause" forState:BEToggleButtonStateNormal];
}
- (nullable NSArray *)accessibilityElements {
return @[self.togglePlayPauseButton];
}
@end
现在,当我打开 VoiceOver 时,它只读取暂停/播放按钮,但我希望行为与 UICollectionView 中的一样,在开始时读取collectionView 的accessibilityLabel,然后读取item accessibilityLabel。
例如:collectionView accessibilityLabel:“collectionView”,单元格的内容标签accessibilityLabel:“单元格的内容标签”,
在我上面描述的 VoiceOver 红色的情况下,它就像:“collectionView,单元格的内容标签”(仅当先前的焦点不是 collectionView 的子视图时);
解决方案
推荐阅读
- mobaxterm - MobaXterm - 使用 alt-f/b 跳转单词
- reactjs - 如何创建一个可以从 React 传递给 jquery 插件的文档对象?
- linear-algebra - 将 Web Mercator 像素坐标映射到屏幕像素
- vb.net - 在 vb.net 中使用变量时是否会重新计算?
- ubuntu - 在 Xubuntu 启动时在终端中运行命令
- react-bootstrap-typeahead - react-bootstrap-typeahead 缓存的实现细节是什么?
- api - Twopart 嵌入式 API 消息 Discord.py(branch>rewrite)
- r - R在将tbl_summary转换为乳胶时如何删除“__”
- python - 如何添加到变量,然后在达到最大值后循环回 0?
- ansible - terraform apply 后在远程控制节点上执行 ansible playbook