Home / IOS Development / How do I make the content of UIScrollView available with VoiceOver? : iOSProgramming

How do I make the content of UIScrollView available with VoiceOver? : iOSProgramming



I try to make the contents of UIScrollView available with VoiceOver without success.

I have a dynamically generated UIImage loaded in a UIImageView inside a UIScrollView. UIImageView has an accessibility label that works outside of UIScrollView, and the ultimate goal is to divide it into several UIAccessibilityElement that is automatically scrolled to when the user highlights them with the VoiceOver cursor, but for now I would only be happy if I could create VoiceOver read UIImageView accessibility label when I press it even if it is inside UIScrollView.

I know that the behavior I want should be possible to achieve since there are other views that inherit from UIScrollView if content is available, I just do not know what to do. I̵

7;ve even tried adding the tutorial to the accessibilityElements array, but it still doesn’t work.

This is a SwiftUI project on iOS 13.6.1; I wrapped UIScrollView in a UIViewRepresentable because ScrollReader is not supported on iOS 13, and I need to control zooming and panning in the scrolling view programmatically, but the problem I have is with UIKit, not SwiftUI.

I have searched all over the web, but there is very little information about the implementation of custom accessibility containers in iOS apps, so I ask here for help.

Thanks in advance to everyone who can point me in the right direction!


Source link