![](/img/trans.png)
[英]iOS Objective-C VoiceOver Updating Available Accessible Elements
[英]`UIPanGestureRecognizer` not accessible to users who are using VoiceOver in iOS
以下代碼將UIPanGestureRecognizer
添加到屏幕上的整個視圖。 當用戶用一根手指在屏幕上平移時,會識別到平移/滑動動作,並會觸發recognizePanGesture(sender: UIPanGestureRecognizer)
。
不幸的是,盡管我的UIPanGestureRecognizer
代碼當前不符合可訪問性。
問題:
如何更改下面的代碼,以確保在iOS中使用VoiceOver的用戶可以完全訪問它?
用戶在激活VoiceOver時進行平移時通常會使用什么特殊手勢動作?
碼:
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用戶可以通過為“ pan-through”手勢添加前綴來進行平移(一指連按兩次並按住,然后繼續該手勢)。 您可能想提供一種替代方法來訪問控件。 一種方法可能是添加並符合UIAccessibilityTraitAdjustable
特征。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.