實例方法
autocorrection
autocorrectionDisabled(_:)
設置是否禁用此視圖的自動更正。
聲明
func autocorrectionDisabled(_ disable: Bool = true) -> some View
參數
disable
一個布爾值,指示是否為此視圖禁用自動更正。默認值為
true
。
詳述
當自動更正的效果會使用戶輸入信息更加困難時,請使用此方法。專有名稱和街道地址的輸入是自動更正可能對用戶完成數據輸入任務的能力產生負麵影響的示例。
下麵的示例使用默認鍵盤配置 TextField
。禁用自動更正允許用戶輸入任意文本,而自動更正係統不會提供建議或嘗試覆蓋他們的輸入。
TextField("1234 Main St.", text: $address)
.keyboardType(.default)
.autocorrectionDisabled(true)
可用版本
iOS 13.0+, iPadOS 13.0+, macOS 10.15+, Mac Catalyst 13.0+, tvOS 13.0+, watchOS 8.0+
相關用法
- Swift Never accessibilityAction(action:label:)用法及代碼示例
- Swift Never alert(isPresented:error:actions:message:)用法及代碼示例
- Swift Never accessibilityAction(_:_:)用法及代碼示例
- Swift Never accessibilityChildren(children:)用法及代碼示例
- Swift Never alert(_:isPresented:presenting:actions:)用法及代碼示例
- Swift Never accessibilityRepresentation(representation:)用法及代碼示例
- Swift Never accessibilityRotor(_:entries:entryID:entryLabel:)用法及代碼示例
- Swift Never accessibilityAction(named:_:)用法及代碼示例
- Swift Never accessibilityChartDescriptor(_:)用法及代碼示例
- Swift Never accessibilityAdjustableAction(_:)用法及代碼示例
- Swift Never alignmentGuide(_:computeValue:)用法及代碼示例
- Swift Never accessibilityShowsLargeContentViewer()用法及代碼示例
- Swift Never accessibilityRotor(_:entries:)用法及代碼示例
- Swift Never accessibilityRotor(_:textRanges:)用法及代碼示例
- Swift Never allowsTightening(_:)用法及代碼示例
- Swift Never alert(isPresented:error:actions:)用法及代碼示例
- Swift Never alert(_:isPresented:actions:)用法及代碼示例
- Swift Never accessibilityRotor(_:entries:entryLabel:)用法及代碼示例
- Swift Never accessibilityScrollAction(_:)用法及代碼示例
- Swift Never alert(_:isPresented:presenting:actions:message:)用法及代碼示例
- Swift Never aspectRatio(_:contentMode:)用法及代碼示例
- Swift Never accessibilityShowsLargeContentViewer(_:)用法及代碼示例
- Swift Never alert(_:isPresented:actions:message:)用法及代碼示例
- Swift Never pageCommand(value:in:step:)用法及代碼示例
- Swift Never opacity(_:)用法及代碼示例
注:本文由純淨天空篩選整理自apple.com大神的英文原創作品 Never autocorrectionDisabled(_:)。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。