用法一
實例方法
text
textContentType(_:)
設置此視圖的文本內容類型,當用戶在 watchOS 設備上輸入文本時,係統會使用該類型提供建議。
聲明
func textContentType(_ textContentType: WKTextContentType?) -> some View
參數
textContentType
WKTextContentType
詳述
使用此方法設置輸入文本的內容類型。例如,您可以為電子郵件地址的條目配置 TextField
:
TextField("Enter your email", text: $emailAddress)
.textContentType(.emailAddress)
可用版本
watchOS 6.0+
用法二
實例方法
text
textContentType(_:)
設置此視圖的文本內容類型,當用戶在 iOS 或 tvOS 設備上輸入文本時,係統使用該類型提供建議。
聲明
func textContentType(_ textContentType: UITextContentType?) -> some View
參數
textContentType
UITextContentType
詳述
使用此方法設置輸入文本的內容類型。例如,您可以為電子郵件地址的條目配置 TextField
:
TextField("Enter your email", text: $emailAddress)
.textContentType(.emailAddress)
可用版本
iOS 13.0+, iPadOS 13.0+, Mac Catalyst 13.0+, tvOS 13.0+
用法三
實例方法
text
textContentType(_:)
設置此視圖的文本內容類型,當用戶在 macOS 上輸入文本時,係統使用該類型提供建議。
聲明
func textContentType(_ textContentType: NSTextContentType?) -> some View
參數
textContentType
NSTextContentType
詳述
使用此方法設置輸入文本的內容類型。例如,您可以為用戶名條目配置TextField
:
TextField("Enter your username", text: $username)
.textContentType(.username)
可用版本
macOS 11.0+
相關用法
- Swift Never textSelection(_:)用法及代碼示例
- Swift Never textInputAutocapitalization(_:)用法及代碼示例
- Swift Never task(priority:_:)用法及代碼示例
- Swift Never tag(_:)用法及代碼示例
- Swift Never transformEffect(_:)用法及代碼示例
- Swift Never touchBarCustomizationLabel(_:)用法及代碼示例
- Swift Never task(id:priority:_:)用法及代碼示例
- Swift Never touchBar(content:)用法及代碼示例
- Swift Never transaction(_:)用法及代碼示例
- Swift Never touchBarItemPrincipal(_:)用法及代碼示例
- Swift Never toggleStyle(_:)用法及代碼示例
- Swift Never touchBarItemPresence(_:)用法及代碼示例
- Swift Never truncationMode(_:)用法及代碼示例
- Swift Never toolbar(id:content:)用法及代碼示例
- Swift Never touchBar(_:)用法及代碼示例
- Swift Never toolbar(content:)用法及代碼示例
- Swift Never tabItem(_:)用法及代碼示例
- Swift Never tint(_:)用法及代碼示例
- Swift Never pageCommand(value:in:step:)用法及代碼示例
- Swift Never opacity(_:)用法及代碼示例
- Swift Never colorMultiply(_:)用法及代碼示例
- Swift Never accessibilityAction(action:label:)用法及代碼示例
- Swift Never alert(isPresented:error:actions:message:)用法及代碼示例
- Swift Never confirmationDialog(_:isPresented:titleVisibility:actions:)用法及代碼示例
- Swift Never flipsForRightToLeftLayoutDirection(_:)用法及代碼示例
注:本文由純淨天空篩選整理自apple.com大神的英文原創作品 Never textContentType(_:)。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。