如何使用 UIAccessibility 协议在 iOS 的模态弹出窗口中捕获焦点? [英] How do I trap focus within a modal popup on iOS using the UIAccessibility protocol?

查看:63
本文介绍了如何使用 UIAccessibility 协议在 iOS 的模态弹出窗口中捕获焦点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户单击 iOS 上的按钮时,我将启动一个自定义弹出窗口.在 iPhone 上使用画外音时,如何确保焦点停留在自定义弹出窗口内(出于可访问性原因)?当前,当我向右滑动时,焦点落在父容器中的元素上.

I am launching a custom popup when the user clicks a button on iOS. How do I make sure that the focus stays within the custom popup (for accessibility reasons) when using voiceover on the iPhone? Currently the focus lands on the elements in the parent container as I swipe right.

推荐答案

如果您的目标是 iOS >= 5.0,那么有一个名为 accessibilityViewIsModal.使用它绝对可以解决您的问题.

If you're targetting for iOS >= 5.0 then there is a property called accessibilityViewIsModal. Using this definitely solve your problem.

如果您的目标是 iOS <5.0 那么对此没有直接的方法.您需要自定义视图控制器的视图并重新排序_accessibleElements",如下所示 此处.请参阅使自定义容器视图的内容可访问部分.

If you're targetting for iOS < 5.0 then there is no a straight way for this. You need to customize your view controller's view and reorder the "_accessibleElements" as shown here. See the section Make the Contents of Custom Container Views Accessible.

这篇关于如何使用 UIAccessibility 协议在 iOS 的模态弹出窗口中捕获焦点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆