用于Voice Over的UITextView设置可以按段落选择/读取

时间:2012-12-17 18:35:34

标签: objective-c voiceover uiaccessibility

我有一个UITextView设置了一个我正在尝试访问的更新日志。我希望如此,启用Voice Over,并选择并阅读整个段落。

目前我可以设置accessibilityTrait并在一个巨大的块中大声朗读整个视图,或者不设置accessibilityTrait设置并且一次只选择一行。有没有办法阻止VoiceOver的段落?

以下是我目前正在使用的代码:

NSString *string = someMultiparagraphString;
NSLog(@"Log is: %@", string);

CGFloat height = [string sizeWithFont:normalFont 
                    constrainedToSize:CGSizeMake(280.0f, CGFLOAT_MAX) 
                        lineBreakMode:UILineBreakModeTailTruncation].height;

CGRect logRect = CGRectMake(10.0f, 10.0f, rect.size.width - 40.0f, height);

UITextView *logView = [[UITextView alloc] initWithFrame:logRect];
logView.font = normalFont;
logView.text = string;
logView.editable = NO;
//logView.accessibilityTraits = UIAccessibilityTraitUpdatesFrequently;
[self addSubview:logView];
[logView release];

0 个答案:

没有答案