iphone - Tap Gesture on part of UILabel -
i add tap gestures part of uitextview following code:
uitextposition *pos = textview.endofdocument;// textview ~ uitextview (int i=0;i<words*2-1;i++){// *2 since uitextgranularityword considers whitespace word uitextposition *pos2 = [textview.tokenizer positionfromposition:pos toboundary:uitextgranularityword indirection:uitextlayoutdirectionleft]; uitextrange *range = [textview textrangefromposition:pos toposition:pos2]; cgrect resultframe = [textview firstrectforrange:(uitextrange *)range ]; uiview* tapviewontext = [[uiview alloc] initwithframe:resultframe]; [tapviewontext addgesturerecognizer:[[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(targetroutine)]]; tapviewontext.tag = 125; [textview addsubview:tapviewontext]; pos=pos2; }
i wish imitate same behaviour in uilabel
. issue is, uitextinputtokenizer
(used tokenize individual words) declared in uitextinput.h
, , uitextview
& uitextfield
conform uitextinput.h
; uilabel
not. there workaround ??
you try https://github.com/mattt/tttattributedlabel , add link label. when link pressed action, part of label click works thing have customizing link part of label. tried in past , worked flawlessly client not interested in using third party component duplicated functionality using uiwebview , html.
Comments
Post a Comment