Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何获取当前文本输入状态以在电子邮件字段、浏览器 url 字段或文本字段之间切换。我想根据当前状态显示@符号、打开按钮或进入按钮。我搜索并尝试了几天,但找不到任何东西。
- 此致
您无权直接访问用户的文本字段。
但是,您可以通过符合UITextInputTraits.
UITextInputTraits
在您的KeyboardViewController中,您想使用self.textDocumentProxy以下属性:returnKeyType和keyboardType
KeyboardViewController
self.textDocumentProxy
returnKeyType
keyboardType