1

我有一个 UITextView 设置了一个更新日志,我试图让它访问。我希望这样,启用旁白,并选择并阅读整个段落。

目前,我可以设置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];
4

0 回答 0