用法一
实例方法
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(_:)。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。