in my project i have 5 row in a TableView each cell having four button totally i have 20 buttons for this my requirement is i want set tag value for Each buttons like
in First Cell -- 1 for btn1, 2 for btn2, 3 for btn3, 4 for btn4
Second Cell-- 5 for btn5, 6 for btn6, 7 for btn7, 8 for btn8
like all Five Cells i need set a tag Value like this
Note: When i scroll the TableView it not changing the tag Value
i have set the tag value like this inside the cellForRowAtIndexPath Delegate Method
UIButton *btnLeftW,*btnLeft,*btnRight,*btnRightW;
btnLeftW=(UIButton*)[cell viewWithTag:90];
btnLeft=(UIButton*)[cell viewWithTag:91];
btnRight=(UIButton*)[cell viewWithTag:92];
btnRightW=(UIButton*)[cell viewWithTag:93];
btnLeftW.tag=indexPath.row;
btnLeft.tag=indexPath.row;
btnRight.tag=indexPath.row;
btnRightW.tag=indexPath.row;
it gives only
0,0,0,0
1,1,1,1
2,2,2,2
3,3,3,3
4,4,4,4
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…