2011-04-02 16 views
7

iPhoneのVoiceOverを使用して、更新されたテキストが変更された場合にラベルに通知することは可能ですか?iPhone - VoiceOverがラベルのテキストを変更するようにする

これは、ARIAのライブ領域に似ています。

ありがとうございました。ラベルは、できるだけ早くそれが更新されると、そのテキストを発表するだけでUILabelを拡張し、setTextメソッドをオーバーライドする必要がある場合は

UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, @"Your text"); 

答えて

18

あなたはVoiceOverのは、あなたが好きなテキストを発表することができます。

.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 

これは私のために完全に働いた:)

関連する問題