我有一個表視圖,在每一行中有兩個單選按鈕在那裏,用於選擇單選按鈕需要計算節號和行號,並在當前的邏輯上到第9行它的工作正常,但第9行後它沒有改變單選按鈕圖像。iphone表視圖問題與index.section和index.row
這裏是我的一塊邏輯實現代碼。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
cell._option1Btn.tag = ((indexPath.section+1)*10)+(indexPath.row+1);
cell._option2Btn.tag = ((indexPath.section+1)*10)+(indexPath.row+1);
return cell;
}
-(void) respondToRightBtnAction:(UIButton*) sender {
if(debug)NSLog(@"In the Right button clicked method");
if(debug)NSLog(@"left button in %d row is YES", sender.tag);
int section = (sender.tag/10 -1);
int row = (sender.tag%10 -1);
}
你在每個部分有多少行? – taskinoor