Dav*_*ave 9 iphone voiceover wai-aria
是否可以使用iPhone上的VoiceOver在标签上发布更新文本?
这类似于ARIA中的活动区域.
谢谢.
小智 19
您可以让VoiceOver宣布您喜欢的任何文字:
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, @"Your text");
Run Code Online (Sandbox Code Playgroud)
如果标签在更新后应立即宣布其文本,则只需扩展UILabel并覆盖该setText方法即可.
.h文件:
@interface UIVoicedLabel : UILabel {
}
@end
Run Code Online (Sandbox Code Playgroud)
它的实施:
#import "UIVoicedLabel.h"
@implementation UIVoicedLabel
- (void) setText:(NSString *)text {
// Set the text by calling the base class method.
[super setText:text];
// Announce the new text.
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, text);
}
@end
Run Code Online (Sandbox Code Playgroud)
这对我来说很完美:)
| 归档时间: |
|
| 查看次数: |
2299 次 |
| 最近记录: |