ios - UITextView inside UITableViewCell - touch go through if not clicking on a link -


i'm trying have advantage of uitextview data detector types inside tableviewcell clickable.

the thing is, need uitextview's links clickable, userinteractionenabled = yes, unfortunately prevent touch going through uitableviewcell.

of course uitextview can't edited, subclassed refusing first responder avoid selecting text in it.

the thing need, detecting if user touch uitextview, check if link, if opening link, otherwise redirect touch on uitableviewcell.

any idea how can done ?

much twitter app (we can either click on row, or on link...)

i know question has been asked while ago, behaviour still needed app have clickable cell uidatadetectors.

so here's uitextview subclass made fit particular behaviour in uitableview

-(id) initwithframe:(cgrect)frame {     self = [super initwithframe:frame];     if (self) {         self.delegate = self;     }     return self; }  - (bool)canbecomefirstresponder {     return no; }  - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event {     uiview *obj = self;      {         obj = obj.superview;     } while (![obj iskindofclass:[uitableviewcell class]]);     uitableviewcell *cell = (uitableviewcell*)obj;      {         obj = obj.superview;     } while (![obj iskindofclass:[uitableview class]]);     uitableview *tableview = (uitableview*)obj;      nsindexpath *indepath = [tableview indexpathforcell:cell];     [[tableview delegate] tableview:tableview didselectrowatindexpath:indepath]; }  - (bool)textview:(uitextview *)textview shouldinteractwithurl:(nsurl *)url inrange:(nsrange)characterrange {     return yes; } 

you can modify fit needs...

hope helps someone.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -