ios - 自定义 View (如收藏 View )上的辅助功能旁白
<p><p>目前我正在处理自定义 View 。 </p>
<p>我需要在标准 UICollectioView 中实现 VoiceOver 的行为。当我将焦点从自定义 View 层次结构之外的元素转换为层次结构中的元素时,VoitserOver 读取自定义 View 的可访问性标签,然后读取所选 View 的可访问性标签</p>
<pre><code>@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 = ;
if (self) {
;
}
return self;
}
- (void)setUp {
// self.isAccessibilityElement = YES;
self.accessibilityLabel = @"Miniplayer.";
self.accessibilityHint = @"Double tap to expand the miniplayer.";
// self.accessibilityElementsHidden = YES;
//set up code
;
;
}
- (nullable NSArray *)accessibilityElements {
return @;
}
@end
</code></pre>
<p>现在,当我打开 VoiceOver 时,它只读取暂停/播放按钮,但我希望行为与 UICollectionView 中一样,一开始读取 collectionView 的 accessibilityLabel,然后读取 item accessibilityLabel。</p>
<p>例如:
Collection View 可访问性标签:“ Collection View ”,
单元格内容标签accessibilityLabel: "单元格内容标签",</p>
<p>在我上面描述的 VoiceOver 红色的情况下,它就像:“collectionView,单元格的内容标签”(仅当先前的焦点不是来自 collectionView 的 subview 时);</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>为了更好地被 VoiceOver 分析, Collection View 可以被视为一个数组,一旦使用 <code>adjustable</code> 特征定义,就应该遍历该数组。</p>
<p>然后必须将 Collection View 的每个元素定义为 <code>UIAccessibilityElement</code>。</p>
<p>要了解应该如何实现,我建议您观看 <code>WWDC 2018 - 提供卓越的可访问性体验</code>视频,其内容完美总结<a href="http://a11y-guidelines.orange.com/mobile_EN/dev-ios-wwdc-18230.html" rel="noreferrer noopener nofollow">here</a>并且其提供的示例可以是<a href="https://developer.apple.com/documentation/uikit/accessibility/delivering_an_exceptional_accessibility_experience" rel="noreferrer noopener nofollow">downloaded</a> .</p></p>
<p style="font-size: 20px;">关于ios - 自定义 View (如收藏 View )上的辅助功能旁白,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/52310057/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/52310057/
</a>
</p>
页:
[1]