作者freejer (.....)
看板MacDev
標題[問題] 記錄點選cell的行數
時間Mon Jun 6 19:48:53 2011
抱歉
短短的幾天碰到很多問題
我想要將我點選到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
1F:→ hechian:[NSNumber numberWithInt:select_row]; 06/07 11:42
2F:→ hechian:把這個丟到NSMutableArray內 06/07 11:42