如何在 ios swift 中为 VoiceOver 设置展开和折叠状态?

How to set Expand and Collapse state in ios swift for VoiceOver?

我正在尝试了解如何为 VoiceOver 屏幕设置展开和折叠状态 reader,但我在任何文档或论坛中都找不到它。

在 Android 上是 AccessibilityNodeInfoCompat.ACTION_EXPAND or AccessibilityNodeInfoCompat.ACTION_COLLAPSE。我想找到 SWIFT IOS 的等效项。有人可以帮我吗?

UIAccessibilityTraits is how states are indicated. It's part of UIAccessibility and not part of Swift, but you can set UIAccessibilityTraits from Swift. However, iOS does not have a natively supported expand/collapse property, unlike Android. You'll have to code around it by using accessibilityHint.