ios - iphone - didSelectRowAtIndexPath: only being called after long press on custom cell -
i creating 1 table view based application. have created custom table cell table, contains 2 labels, 1 image , 1 button. table view data source method working properly. using xib both custom cell , view controller class , connect delegate , data source file's owner. problem when select table row, didselectrowatindexpath not getting fire. mentioned way fire hold down on cell 3-4 seconds. have idea why happening?
thanks pointers...
here table view methods..
- (nsinteger)numberofsectionsintableview:(uitableview *)tableview { return 1; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { return [finaladdonsarray count]; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; newcustomcell *cell = (newcustomcell*)[tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { nsarray *nib=[[nsbundle mainbundle]loadnibnamed:@"newcustomcell" owner:self options:nil]; cell=[nib objectatindex:0]; } addons *addons1=[[addons alloc]init]; addons1= [finaladdonsarray objectatindex:indexpath.row]; if (addons1.data == nil) { cell.ivcategory.image = [uiimage imagenamed:@"blogo.jpg"]; } else { cell.ivcategory.image=[uiimage imagewithdata:addons1.data]; } cell.lbltitle.text = addons1.name; if (addons1.price == nil) { cell.lblprice.text = nil; } else{ cell.lblprice.text = [nsstring stringwithformat:@"%@ rs",addons1.price]; } [cell.button addtarget:self action:@selector(editbuttonpressed:) forcontrolevents:uicontroleventtouchupinside]; cell.button.tag=indexpath.row; index = indexpath; cell.selectionstyle = uitableviewcellselectionstylegray; return cell; } -(void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { nslog(@"sjcjksbcjksbcfkebscf1234567890"); }
one more thing getting if using default uitableviewcell instead of custom cell problem same, delegate method not getting fire.
custom cell properties:
same problem happened me because have added tap gesture recogniser on it. if have used gesture recognizer try removing , check if causing problem.
edit: solution commented ali: if have used tap gesture can use [tap setcancelstouchesinview:no];
Comments
Post a Comment