iphone - How to create a Button action inside custom table cell in ios -
i'm using custom tablecell
, want 2 button action inside cell
1 pushviewcontroller
, 1 popviewcontrolleranimated
how can achieved ?
in custom cell you'll have create 2 buttons. write following code in cellforrowatindexpath
:
-(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { cellcustomcell *cell = [tableview dequeuereusablecellwithidentifier:@"customcell"]; cell.btnpop.tag = indexpath.row; [cell.btnpop addtarget:self action:@selector(popbuttonclicked:) forcontrolevents:uicontroleventtouchupinside]; cell.btnpush.tag = indexpath.row; [cell.btnpush addtarget:self action:@selector(pushbuttonclicked:) forcontrolevents:uicontroleventtouchupinside]; return cell; }
it important set tags button they'll tell row button clicked.
define actions :
-(void)popbuttonclicked:(id)sender { } -(void)pushbuttonclicked:(id)sender { }
Comments
Post a Comment