ios - How to call the button action depend upon the tag in uiTableView? -
i have button in single cell , set tag button.
button uparrow creation:
uibutton *btn_uparrow=[[uibutton alloc]initwithframe:cgrectmake(500, 20, 50, 50)]; [btn_uparrow settitle:@"up" forstate:uicontrolstatenormal]; btn_uparrow.backgroundcolor =[uicolor blackcolor]; [btn_uparrow addtarget:self action:@selector(btn_up_arrow:) forcontrolevents:uicontroleventtouchupinside]; [btn_uparrow settag:indexpath.row]; [cell addsubview:btn_uparrow];
uparrow button action method
-(void)btn_up_arrow:(uibutton*)click { i++; nslog(@"increment %d",i); if(i>=5) { nslog(@"button increment %d",i); i--; } }
when click button in separate cell increment continue on previous data.
please use following code.
nsinteger tagval = (uibutton*)click.tag;
and check tagval variable value.
Comments
Post a Comment