2011-04-02 16 views

回答

18

你可以讓VoiceOver會宣佈你喜歡的任何文字:

UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, @"Your text"); 

如果標籤應該儘快更新它宣佈其文本,簡單地延長UILabel並重寫setText方法。

.h文件:

@interface UIVoicedLabel : UILabel { 

} 

@end 

及其實施:

#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 

這完美的工作對我來說:)