VoiceOver不能在横向滚动到屏幕外的元素?

时间:2022-11-25 16:54:06

How can I make a VoiceOver scroll to elements offscreen in a UIScrollView.

如何在UIScrollView中将VoiceOver滚动到屏幕外的元素。

I have a UIScrollView. Inside this is a UIView containing a number of subviews. Inside these subviews are labels - something like below:

我有一个UIScrollView。在这里面是一个包含许多子视图的UIView。这些子视图中有标签 - 如下所示:

Scroll View
-> UIView
--> UIView
----> Label
--> UIView
----> Label
--> UIView
----> Label
--> UIView
----> Label
--> UIView
----> Label

When I launch my app in landscape, I can see that some of the elements are offscreen. I can scroll to these without issue. When using VoiceOver however, I can swipe to move through the elements on screen but the app doesn't scroll past the last visible element on the screen by swiping alone. If I rotate the iPad into portrait mode I can swipe to the elements that weren't accessible and continue to swipe to other elements that are off screen in portrait mode. I can use a three finger swipe to move down to the next "page" and select an element to continue, but this isn't what I had expected. I had expected to just keep swiping and the next element would scroll into view.

当我在横向上启动我的应用程序时,我可以看到一些元素在屏幕外。我可以毫无问题地滚动到这些。但是,当使用VoiceOver时,我可以滑动以在屏幕上移动元素,但是应用程序不会通过单独滑动滚动浏览屏幕上的最后一个可见元素。如果我将iPad旋转到纵向模式,我可以滑动到无法访问的元素,并继续滑动到纵向模式下屏幕外的其他元素。我可以使用三指滑动向下移动到下一个“页面”并选择一个元素继续,但这不是我所期望的。我曾期望只是继续滑动,下一个元素将滚动到视图中。

The app is written in Swift 1.2 using Xcode 6.4 and I'm running the app on an iPad Mini 2 running iOS 8.4

该应用程序是使用Xcode 6.4在Swift 1.2中编写的,我在运行iOS 8.4的iPad Mini 2上运行该应用程序

Any ideas?

有任何想法吗?

2 个解决方案

#1


2  

It is your responsibility to scroll in response to focus changes. Use the UIAccessibilityFocus Protocol to monitor current focus and scroll the view programmatically when an offscreen element is focused.

您有责任滚动以响应焦点更改。使用UIAccessibilityFocus协议监视当前焦点,并在关闭屏幕外元素时以编程方式滚动视图。

#2


0  

accessibilityElements

An array of the accessibility elements in the container. You can implement this property instead of the dynamic methods to support the retrieval of the contained elements. The default value of this property is nil.

容器中的辅助功能元素的数组。您可以实现此属性而不是动态方法来支持检索包含的元素。此属性的默认值为nil。

You can reassign value of accessibilityElements of your accessibility view in following manner:

您可以按以下方式重新分配辅助功能视图的accessibilityElements的值:

self.containerView.accessibilityElements = [self.label1,
                                            self.label2,
                                            self.label3,
                                            self.label4,
                                            self.label1]


self.scrollView.accessibilityElements = [self.containerView]

#1


2  

It is your responsibility to scroll in response to focus changes. Use the UIAccessibilityFocus Protocol to monitor current focus and scroll the view programmatically when an offscreen element is focused.

您有责任滚动以响应焦点更改。使用UIAccessibilityFocus协议监视当前焦点,并在关闭屏幕外元素时以编程方式滚动视图。

#2


0  

accessibilityElements

An array of the accessibility elements in the container. You can implement this property instead of the dynamic methods to support the retrieval of the contained elements. The default value of this property is nil.

容器中的辅助功能元素的数组。您可以实现此属性而不是动态方法来支持检索包含的元素。此属性的默认值为nil。

You can reassign value of accessibilityElements of your accessibility view in following manner:

您可以按以下方式重新分配辅助功能视图的accessibilityElements的值:

self.containerView.accessibilityElements = [self.label1,
                                            self.label2,
                                            self.label3,
                                            self.label4,
                                            self.label1]


self.scrollView.accessibilityElements = [self.containerView]