小编ran*_*onk的帖子

将子视图添加到自定义viewForHeaderInSection会中断VoiceOver导航

我有一个UITableViewController,我试图自定义节标题看起来更像纯文本.我发现当我向自定义headerView添加子视图(详见下文)时,它会破坏VoiceOver标题导航.

例如:假设我有一个包含三个标题的表:Header1,Header2,Header3.

如果没有viewForHeaderInSection方法的自定义实现,我可以切换画外音转子以按标题导航,一切都按预期工作.

当我以下面的方式实现viewForHeaderInSection方法时,我可以从Header1移动到Header2到Header3并返回到Header2,但是然后画外音丢失所有标题(说"找不到标题").

当我将headerLabel作为子视图添加到headerView时,我发现问题就出现了.我已经尝试将headerLabel设置为隐藏的辅助功能元素,因此画外音不会提取它,但问题仍然存在.

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 
{

UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0,0,tableView.frame.size.width,30)];

UILabel *headerLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, headerView.frame.size.width-120.0, headerView.frame.size.height)];

headerLabel.textAlignment = UITextAlignmentLeft;
headerLabel.font = [UIFont boldSystemFontOfSize:22];
headerLabel.text = [headersArray objectAtIndex:section];
headerLabel.backgroundColor = [UIColor clearColor];

[headerView addSubview:headerLabel];

return headerView;

}
Run Code Online (Sandbox Code Playgroud)

任何有关VoiceOver如此反应的想法都将受到赞赏.

谢谢.

uitableview ios voiceover ios5

6
推荐指数
1
解决办法
2253
查看次数

iPhone:如何让VoiceOver识别标准手势

现在我有一些非常简单的代码设置来识别手势.但是,当我的设备启用了VoiceOver并且我尝试使用双击手势功能(通过voiceOver将手势传递到应用程序中)时,它似乎无法识别手势.

澄清更多:通常情况下,如果您正在使用启用了配音的应用程序并且应用程序具有一些手势识别功能,您可以双击并按住一秒钟,配音将播放音调.然后,您可以执行手势,并将通过画外音传递到应用程序.我的问题是,当我双击并按住时,画外音不会播放音调.

所以我想知道是否有一些东西我必须包含在我的代码中以通知画外音,我的应用程序将使用手势,或者那种效果.

码:

- (void)viewDidLoad
{
[super viewDidLoad];

// Swipe Left
UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc]
                                       initWithTarget:self action:@selector(handleSwipeLeft:)];

swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
[self.view addGestureRecognizer:swipeLeft];
[swipeLeft release];

// Swipe Right
UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc]
                                        initWithTarget:self action:@selector(handleSwipeRight:)];

swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
[self.view addGestureRecognizer:swipeRight];
[swipeRight release];
}


- (void)handleSwipeLeft:(UISwipeGestureRecognizer *)recognizer 
{

CGPoint location = [recognizer locationInView:self.view];
NSLog(@"Swipe left started at (%f,%f)",location.x,location.y);
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, @"Swipe Left");
}

- (void)handleSwipeRight:(UISwipeGestureRecognizer *)recognizer 
{

CGPoint location = [recognizer locationInView:self.view];
NSLog(@"Swipe right started at (%f,%f)",location.x,location.y);
}
Run Code Online (Sandbox Code Playgroud)

iphone uigesturerecognizer ios

5
推荐指数
1
解决办法
1433
查看次数

使UIWebView可访问

简单的问题.

我有一个UIWebView.它显示带有几个标题的简单html文本.我希望VoiceOver能够阅读此Web视图的内容.

如果我可以利用VoiceOver的转子让用户使用标题滚动内容也会很好,但我不会贪婪.

任何输入都表示赞赏.

iphone accessibility uiwebview ios voiceover

2
推荐指数
1
解决办法
5514
查看次数