![](/img/trans.png)
[英]How to restore UIInputViewController self.view after dismissing the keyboard?
[英]How to Send Text in an UIInputViewController
所以我有以下代碼來插入文本:
func insert(text: String) {
(textDocumentProxy as UIKeyInput).insertText(text)
}
但是我實際上如何將其發送到聊天窗口?
如果您要訪問UIInputViewController
輸入的所有文本,則以下代碼可能會有所幫助:
var totalText = "" // complete text entered
if let before: String = self.textDocumentProxy.documentContextBeforeInput {
totalText += before
}
if let after: String = self.textDocumentProxy.documentContextAfterInput {
totalText += after
}
現在您已經輸入了完整的文本,您可以將其發送到聊天窗口。 如果您正在尋找這些限制,那么我可以分享一些限制。 請告訴我
編輯
要將文本發送到whatsapp
,您需要按custom keyboard extension
outside
的send button
。 如果要將文本輸入到whatsapp
的UITextView
中,則非常簡單。 但是, custom keyboard extension
無法控制whatsapp
的發送按鈕
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.