ユーザータイプが「@」で、特定の検索キーワードがUITextView
であるときにドロップダウンリストを表示する方法はありますか?例についてはユーザータイプが「@」のときにリストからデータを検索する
:
タイプ「@ios」と単語「IOS」ドロップダウンリストの一覧とshowからフィルタを含んでいるすべての文字列。私は常に、ユーザーのタイプのテキストをチェックすることによって、これを達成
func textView(_ textView: UITextView, shouldChangeTextInRange range: NSRange, replacementText text: String) -> Bool {
if (textView.text.appending(text) == "@") {
//trigger '@' operation
if arrayObject.contains(value) {
//Populate array and display tableview.
}
}
else if (textView.text.appending(text) == "/") {
//trigger/operation
}
//Same conditions go on
}
要件に応じて次のリンクを参照してください。 https://github.com/EddyBorja/MLPAutoCompleteTextField https://www.raywenderlich.com/336/auto-complete-tutorial-for-ios-how-to-auto-complete-with-custom-values – Venkat