Does VoiceOver read tags in a previous view in an iPhone app? error?

I am creating a view-based application where I will move on to the next view using the addSubview method. The problem is that when I turn on VoiceOver ON and addubviews, it takes accessory tags from previous views. That is, if I click on the view in the rectangle where there is a label in the previous view, then also VoiceOver will detect this as an accessibility label and begin to read this label. But, if I use the navigation controller to go to the next view controller, I don't get any problems. Can someone please tell me if the apple itself supports VoiceOver only for a navigation-based application, or is there some other VoiceOver solution in view-based applications?

PS I also tried the same thing in some demo applications, but the same results.

So, when in the current view I add a subview that contains buttons, the accessibility also reads the labels behind the preview. I want accessibility to read buttons on the added view, and the rest of only the visible part of the previous view (and not the labels hidden behind the added view). can someone tell if this is a scoring error on the iPhone that by default it also reads parentView shortcuts on addubview?

+4
source share
4 answers

Use this screen with a modified notification

 UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, nil); 

if you need to focus on a specific object / view, then pass them to nil.

+1
source

If the view is in the view hierarchy, even if it is closed by another view on top of it, VoiceOver will detect it.

You should not switch to a different content screen by simply adding a new view over the previous one. Each screen of your application should be a UIViewController , not just a UIView . This gives you many advantages, one of which is that the view controller can automatically unload its view when it is turned off, and a memory warning appears.

To control the transitions between screens in the application, you must use a container controller, for example, a navigation controller (or your own custom one). You can turn off the navigation bar and transition effects if you want, and just use it to control the view stack. When you push a new view controller onto the stack, the previous one will be deleted and your problem will disappear.

So, you need to seriously review the way you manage your screens and views. UIViewController inside some container is the way to go. At the very least, you should remove the old view when adding a new one to the screen.

+6
source

I had the same problem as you, and I spent some time to solve this problem. When you add view B to view A, you do not hide view A. The view continues there, and, as expected, voiceOver, it will read that view / label.

You can use the Debug view that Xcode provides you with to see this problem. I wrote an example to demonstrate how voiceOver sees your tags.

When you use addSubview, the view hierarchy looks like this:

overview

So, in this case, a container view with Hello Stack! shortcut above Hello World shortcut. As a user, you cannot see the Hello World shortcut. However, voiceOver can see this view.

Well, now that the problem is known, the solution is this: whenever you want to add a view differently, you hid the previous view first. Then use Debug View for xcode to find out what your views look like.

I will fix this to show you how to fix the error I demonstrated:

In code: enter image description here

Debugging:

  • first tag: postimg.org/image/cabhadzrl/
  • second label: postimg.org/image/nsldgjb41/5605fbcd/

If you are an observer, I have added a view container between labels, but this view is just to improve the vision of the hierarchy.

+2
source

You can set the accessibilityViewIsModal property for the view to YES.

@property (non-atomic) BOOL accessibilityViewIsModal NS_AVAILABLE_IOS (5_0);

Tells whether the receiving presentation should be considered modal in availability. If YES, then elements outside this view will be ignored. Only items inside this view are displayed. default == NO

so any view you add set its accessibilityViewIsModal to YES / true.

view.accessibilityViewIsModal = YES

+2
source

Source: https://habr.com/ru/post/1403557/


All Articles