Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VoiceOver reads labels on previous view in iPhone app? bug?

I am creating view based application, where i will be going to next view, via addSubview method. The problem is, when I turn the feature of VoiceOver ON, and addsubviews, it takes the accessory labels from previous views. That is , if I click on view at the rect, where there is label in previous view, then also, VoiceOver will detect it as accessibility label and start reading that label. But, If I use, navigation controller to go to next view controller, I don't get any problem. Can anyone please tell me, if apple itself has supported VoiceOver facility only for navigation based application, or there is some other solution for VoiceOver in view based applications ?

PS I have tried the same on some demo apps also, but same results.

So, when in current view I am adding a subview which contains buttons, accessibility reads the labels behind the subview as well. I want the accessibility to read buttons on added view, and rest of the viewable part of the previous view only(and not the labels got hidden behind added view). can someone tell, if it is a bug of voiceover in iPhone, that by default, it reads parentView's labels also, on addsubview ?

like image 336
vipsk Avatar asked Mar 26 '12 22:03

vipsk


People also ask

What is iPhone accessibility VoiceOver?

With VoiceOver—a gesture-based screen reader—you can use iPhone even if you can't see the screen. VoiceOver gives audible descriptions of what's on your screen—from battery level, to who's calling, to which app your finger is on. You can also adjust the speaking rate and pitch to suit your needs.

What is VoiceOver accessibility?

Smartphones and tablets have their own “voice” that reads out loud whatever is on the screen for you. This can be a notification, the name of the app you tap on, a website, the information of a caller or the content of your emails and text messages.

How do I VoiceOver in xcode?

While VoiceOver is not available directly in the Xcode simulator, it is possible to run VoiceOver from macOS to test your app. To do this, set keyboard focus on the simulator window then enable VoiceOver. From here you'll be able to use the Virtual Cursor to move between items on the screen.


2 Answers

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

You should not be moving to another screen of content by just adding a new view on top of the previous one. Each screen of your app should be a UIViewController, not just a plain UIView. This gives you many advantages, one of which is that a view controller can automatically unload its view when it is off screen and there is a memory warning.

To manage transitions between screens in your app, you should use a container controller like a navigation controller (or your own custom one). You can disable the navigation bar and transition effects if you like, and just use it to manage your stack of views. When you push a new view controller onto the stack, the previous one will be removed and your problem goes away.

So you should seriously reconsider the way you are managing your screens and views. UIViewController inside some sort of container is the way to go. At the very least, you should be removing the old view when you add a new one to the screen.

like image 163
Mike Weller Avatar answered Oct 13 '22 00:10

Mike Weller


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

@property (nonatomic) BOOL accessibilityViewIsModal NS_AVAILABLE_IOS(5_0);

Informs whether the receiving view should be considered modal by accessibility. If YES, then elements outside this view will be ignored. Only elements inside this view will be exposed. default == NO

so whatever view you are adding, set it's accessibilityViewIsModal to YES / true.

view.accessibilityViewIsModal = YES

like image 40
kenoy Avatar answered Oct 13 '22 00:10

kenoy