Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何讓聊天氣泡中的文字變成可選擇像是UITextField那樣? #44

Closed
EllisShen opened this issue Jul 2, 2018 · 4 comments

Comments

@EllisShen
Copy link

我知道目前氣泡中的文字是用YYLabel元件,如果我想讓自泡中的文字變成可選擇(Selectable),該如何做?

@hilen
Copy link
Owner

hilen commented Jul 2, 2018

你可以尝试写正则匹配出来你想要的文字对它进行可选操作。
就好比里面解析电话号码一样。

@EllisShen
Copy link
Author

EllisShen commented Jul 9, 2018

@hilen 謝謝你的回覆 我成功的把YYLabel 改為YYTextView, 現在每個氣泡可以被選擇並且選擇後會顯示出UIMenu。 不過我遇到個問題,每個YYTextVie選取後的UIMenu都是獨立的,就很容易出現,一個氣泡選取後,使用者又選擇了另外一個氣泡,兩個氣泡的選擇區都不會消失。 在您的project裡面,在那邊可以呼叫textField.endEditing?

@hilen
Copy link
Owner

hilen commented Jul 9, 2018

可以持有一个临时的 YYTextView,当触控到一个 YYTextView 的时候,设置这个临时的为当前的 YYTextView,这样是不是可以做到控制界面上就显示一个 UIMenu?

@EllisShen
Copy link
Author

謝謝@hilen,這個主意挺好的,我來試試看

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants