简体   繁体   English

iOS中使用VoiceOver的用户无法访问“ UIPanGestureRecognizer”

[英]`UIPanGestureRecognizer` not accessible to users who are using VoiceOver in iOS

The below code adds a UIPanGestureRecognizer to the whole view on screen. 以下代码将UIPanGestureRecognizer添加到屏幕上的整个视图。 When a user pans across the screen with one finger the panning/swiping action is recognised and recognizePanGesture(sender: UIPanGestureRecognizer) is triggered. 当用户用一根手指在屏幕上平移时,会识别到平移/滑动动作,并会触发recognizePanGesture(sender: UIPanGestureRecognizer)

Unfortunately though my UIPanGestureRecognizer code is currently not accessibility compliant. 不幸的是,尽管我的UIPanGestureRecognizer代码当前不符合可访问性。


Questions: 问题:

How can I change the code below to ensure that it is completely accessible to users who are using VoiceOver in iOS? 如何更改下面的代码,以确保在iOS中使用VoiceOver的用户可以完全访问它?

What is the special gesture action a user typically uses when panning with VoiceOver active? 用户在激活VoiceOver时进行平移时通常会使用什么特殊手势动作?


Code: 码:

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        panGestureAdd()
    }

    func panGestureAdd() {
        let panGesture: UIPanGestureRecognizer = UIPanGestureRecognizer(target: self, action: #selector(ViewController.recognizePanGesture(_:)))
        panGesture.minimumNumberOfTouches = 1
        panGesture.maximumNumberOfTouches = 1
        self.view.addGestureRecognizer(panGesture)
    }

    func recognizePanGesture(sender: UIPanGestureRecognizer) {
        print("UIPanGestureRecognizer active.")
    }

}

VoiceOver users can perform a pan by prefixing it with the "pass-through" gesture (one-finger double-tap and hold before continuing with the gesture). VoiceOver用户可以通过为“ pan-through”手势添加前缀来进行平移(一指连按两次并按住,然后继续该手势)。 You may want to offer an alternative method to access the control. 您可能想提供一种替代方法来访问控件。 One approach might be to add and conform to the UIAccessibilityTraitAdjustable trait. 一种方法可能是添加并符合UIAccessibilityTraitAdjustable特征。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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