Detecting touched character
I'm looking for the best way to detect a character (in a short string, drawn in a large font) touched by the user, and send an accompanying event. It looks like I might be able to do this by looking at the location of a touches ended event inside of a UILabel with "User Interaction Enabled" turned on, or maybe by programmatically creating a row of transparent buttons, each with a single character title ([A][P][P][L开发者_JS百科][E]), but before attempting that I wanted to tap the collective wisdom here and see if maybe I might be overlooking something easy and obvious...
Any ideas?
I think the two easy options would be experimenting with a row of labels or buttons to see what works best, just like you suggested. If that wont work you have to create your own UIView
(possibly extending UILabel
) and dive into the drawing code to find out the exact location of a 'printed' character to determine where the user touches.
精彩评论