简体   繁体   中英

VoiceOver not scrolling to elements offscreen in landscape?

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

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

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.

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

Any ideas?

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.

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 .

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

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


self.scrollView.accessibilityElements = [self.containerView]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM