Wednesday, 15 September 2010

ios - UILabel with Gesture Recognizer inside UITableViewCell blocks didSelectRowAtIndexPath -



ios - UILabel with Gesture Recognizer inside UITableViewCell blocks didSelectRowAtIndexPath -

i utilize uilabels uitapgesturerecognizer within uitableviewcell. gesturerecognizer works well. when tap on label, want didselectrowatindexpath: should execute too. or indexpathforselectedrow() method should give me selected row.

setting cancelstouchesinview = false did not work!

is possible? right indexpathforselectedrow() method returns nil.

why using uitapgesturerecognizer? if want utilize that, seek set tag of label label.tag=indexpath.row. might value looking at. regarding own opinion, i'd remove uitapgesturerecognizer , straight utilize didselectrowatindexpath method..

edit 2:

try using solution..it might help you..

-(void)handletap:(uitapgesturerecognizer *)sender { cgpoint location = [sender locationinview:self.view]; if (cgrectcontainspoint([self.view convertrect:self.yourtableview.frame fromview:self.tableview.superview], location)) { cgpoint locationintableview = [self.yourtableview convertpoint:location fromview:self.view]; nsindexpath *indexpath = [self.yourtableview indexpathforrowatpoint:locationintableview]; if (indexpath) [self tableview:self.yourtableview didselectrowatindexpath:indexpath]; return; } }

ios uitableview uilabel uitapgesturerecognizer didselectrowatindexpath

No comments:

Post a Comment