用法一
實例方法
accessibility
accessibilityAction(named:_:)
向視圖添加可訪問性操作。動作允許輔助技術(例如 VoiceOver)通過調用動作與視圖交互。
聲明
func accessibilityAction<S>(
named name: S,
_ handler: @escaping () -> Void
) -> ModifiedContent<Self, AccessibilityAttachmentModifier> where S : StringProtocol
詳述
例如,這就是如何將編寫新電子郵件的自定義操作添加到視圖中。
var body: some View {
ContentView()
.accessibilityAction(named: "New Message") {
// Handle action
}
}
可用版本
iOS 14.0+, iPadOS 14.0+, macOS 11.0+, Mac Catalyst 14.0+, tvOS 14.0+, watchOS 7.0+
用法二
實例方法
accessibility
accessibilityAction(named:_:)
向視圖添加可訪問性操作。動作允許輔助技術(例如 VoiceOver)通過調用動作與視圖交互。
聲明
func accessibilityAction(
named name: Text,
_ handler: @escaping () -> Void
) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
詳述
例如,這就是如何將編寫新電子郵件的自定義操作添加到視圖中。
var body: some View {
ContentView()
.accessibilityAction(named: Text("New Message")) {
// Handle action
}
}
可用版本
iOS 13.0+, iPadOS 13.0+, macOS 10.15+, Mac Catalyst 13.0+, tvOS 13.0+, watchOS 6.0+
用法三
實例方法
accessibility
accessibilityAction(named:_:)
向視圖添加可訪問性操作。動作允許輔助技術(例如 VoiceOver)通過調用動作與視圖交互。
聲明
func accessibilityAction(
named nameKey: LocalizedStringKey,
_ handler: @escaping () -> Void
) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
詳述
例如,這就是如何將編寫新電子郵件的自定義操作添加到視圖中。
var body: some View {
ContentView()
.accessibilityAction(named: "New Message") {
// Handle action
}
}
可用版本
iOS 14.0+, iPadOS 14.0+, macOS 11.0+, Mac Catalyst 14.0+, tvOS 14.0+, watchOS 7.0+
相關用法
- Swift Never accessibilityAction(action:label:)用法及代碼示例
- Swift Never accessibilityAction(_:_:)用法及代碼示例
- Swift Never accessibilityAdjustableAction(_:)用法及代碼示例
- Swift Never accessibilityChildren(children:)用法及代碼示例
- Swift Never accessibilityRepresentation(representation:)用法及代碼示例
- Swift Never accessibilityRotor(_:entries:entryID:entryLabel:)用法及代碼示例
- Swift Never accessibilityChartDescriptor(_:)用法及代碼示例
- Swift Never accessibilityShowsLargeContentViewer()用法及代碼示例
- Swift Never accessibilityRotor(_:entries:)用法及代碼示例
- Swift Never accessibilityRotor(_:textRanges:)用法及代碼示例
- Swift Never accessibilityRotor(_:entries:entryLabel:)用法及代碼示例
- Swift Never accessibilityScrollAction(_:)用法及代碼示例
- Swift Never accessibilityShowsLargeContentViewer(_:)用法及代碼示例
- Swift Never alert(isPresented:error:actions:message:)用法及代碼示例
- Swift Never autocorrectionDisabled(_:)用法及代碼示例
- Swift Never alert(_:isPresented:presenting:actions:)用法及代碼示例
- Swift Never alignmentGuide(_:computeValue:)用法及代碼示例
- Swift Never allowsTightening(_:)用法及代碼示例
- Swift Never alert(isPresented:error:actions:)用法及代碼示例
- Swift Never alert(_:isPresented:actions:)用法及代碼示例
- Swift Never alert(_:isPresented:presenting:actions:message:)用法及代碼示例
- Swift Never aspectRatio(_:contentMode:)用法及代碼示例
- Swift Never alert(_:isPresented:actions:message:)用法及代碼示例
- Swift Never pageCommand(value:in:step:)用法及代碼示例
- Swift Never opacity(_:)用法及代碼示例
注:本文由純淨天空篩選整理自apple.com大神的英文原創作品 Never accessibilityAction(named:_:)。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。