[問題] 記錄點選cell的行數

看板MacDev作者 (.....)時間14年前 (2011/06/06 19:48), 編輯推噓0(002)
留言2則, 1人參與, 最新討論串1/2 (看更多)
抱歉 短短的幾天碰到很多問題 我想要將我點選到cell的index存入array中 但目前回傳的都是null 想請大家幫忙 謝謝 - (void)tableView:(UITableView *)table didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [table cellForRowAtIndexPath:indexPath]; NSString *temp; group=[NSMutableArray array]; NSUInteger select_row=[indexPath row]; if (cell.accessoryType != UITableViewCellAccessoryCheckmark) { cell.accessoryType = UITableViewCellAccessoryCheckmark; ----->點選到的cell會出現打勾的mark [group addObject:indexPath.row];---------------->想要將行數加入 temp=[group objectAtIndex:select_row];--------->丟到字串中讀出 } NSLog(@"row: %@ is marked ~~ delete it!",temp); [group release]; } 大概是這樣的概念 會用array是因為我需要點選很多次 一次把它記錄起來在讀出 再次謝謝大家的指導 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 111.240.175.138

06/07 11:42, , 1F
[NSNumber numberWithInt:select_row];
06/07 11:42, 1F

06/07 11:42, , 2F
把這個丟到NSMutableArray內
06/07 11:42, 2F
文章代碼(AID): #1DxBwe-F (MacDev)
討論串 (同標題文章)
文章代碼(AID): #1DxBwe-F (MacDev)