I have a question about CTLineGetStringIndexForPosition in core text.
I have a text like this one:
Question: Hello, how are you today?
Answer: I am fine thank you
Question: great day isn't it?
...
On the above text i have set attributes for each one 'Question:' word to make it tappable . I am putting all this text on an UITableview cell. I have many similar cells with questions and answers.
When i touch The 'Question:' word on one of the cells the index i get is correct. I scroll down in the UITableview and then i have another text like the one before. When i tap on 'Question:' the index is not right.
This is how i implement the index.
index = CTLineGetStringIndexForPosition(line,CGPointMake(lineOrigins[i].x + pnt.x, pnt.y));
Any help appreciated!
pntcoming from? Are you certain that it's aligned with the baseline lower-left corner of the text? There is very little to go on here. - Rob Napier