Closed KC-218 closed 6 years ago
No this is not possible out of the box. To be honest, as a user if I see mentions with @
or even two hashtags which they are the same I would expect they both end up in the same place.
You can do something with their positions in the text like which one is before or after the other one once the function being triggered. But i guess this only works with only two similar, more than two is complicated.
Regarding this issue Please update class according to below logic so might it will work for that which exact text has clicked
Take a dictionary to store details for specific text like If have a user name with more detail (user_id, first name, Las name) then in that dictionary we store all details and when click on that user name then return that same dictionary in call back block so from that dictionary we can identify that exactly which text has clicked
Please email me when update anything on below Email id krishnasoni2113@gmail.com
The question is different than which element is being tapped on. Of course you’ll get the value and you can map it back to some dictionary or just use it as is to query an API, etc. The question was/is, if all the value are the same how to sperate them to do different actions. This is a bad practice. As a user you expect to see @maziyarpanahi any where in the text and you expect that goes or does the same thing regardless of its position in the text. If the question is #aaa #bbb #ccc then yeah just use the value return in the function to map it to dictionary or just quesry the value from an API.
Does "ActiveLabel.swift" have any function to know which string I click?
label.text = "@aaa @bbb @aaa"
label.handleMentionTap({ (string) in //How to do something? })
How to know which @aaa I click, If I want two of them to do different things?