目标c ios通过一次触摸检查多个单元格
我想用一次点击(触摸)检查更多单元格 在这段代码中,我试着按照我说的做。。。我有一些问题目标c ios通过一次触摸检查多个单元格,ios,Ios,我想用一次点击(触摸)检查更多单元格 在这段代码中,我试着按照我说的做。。。我有一些问题 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSString *riga; int esci=0; UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; NSDictionary
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *riga;
int esci=0;
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
NSDictionary *itemAtIndex = (NSDictionary *)[listad objectAtIndex:indexPath.row];
riga=[itemAtIndex objectForKey:@"riga"];
for (int i=0; i<[righeS count]; i++) {
if ([righeS objectAtIndex:i] ==riga) {
cell.accessoryType=UITableViewCellAccessoryNone;
//[tableView deselectRowAtIndexPath:indexPath animated:YES];
[righeS removeObjectAtIndex:i];
esci=1;
}
}
if (esci==0) {
[righeS addObject:riga];
cell.accessoryType = UITableViewCellAccessoryCheckmark;
//Check if value of qty of the next row is 0
bool trovato=FALSE;
for (int g =0 ;g <[listad count];g++){
NSDictionary *rigaScan=(NSDictionary*)[listad objectAtIndex:g];
if (trovato==TRUE) {
if ([[rigaScan objectForKey:@"qty"] isEqualToString: @"0"]){
NSString *rig;
rig=[rigaScan objectForKey:@"riga"];
[righeS addObject:rig];
cell.accessoryType=UITableViewCellAccessoryCheckmark;
}else{
break;
}
}
if ([rigaScan objectForKey:@"riga"]==riga){
trovato=TRUE;
}
[rigaScan release];
}
//Fine controllo
}
}
-(void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(nsindepath*)indepath{
NSString*里加;
int-esci=0;
UITableViewCell*单元格=[tableView cellForRowAtIndexPath:indexPath];
NSDictionary*itemAtIndex=(NSDictionary*)[listad objectAtIndex:indexath.row];
riga=[itemAtIndex objectForKey:@“riga”];
对于(int i=0;i尝试一下Cocoa With Love的这篇精彩文章-让我澄清一件事,你基本上想要的是检查多个单元格?是的,我选择一个,如果下一个是某个字段0,那么你选择一个,然后你检查其他单元格是否有某个值为0的字段,如果是,那么选择它太好了?@mrhawk是的,太好了!!!下一行的其他部分!!谢谢Srikar的回答,事实上我下载了链接的源代码,但我刚刚做了这个。我的问题是另一个问题,当用户检查一行或单元格时,如果下一行的值是0,他们也会自动检查。我也知道很多!这不是一个精确的解决方案,但你不能弱化它以满足您的需要。如果需要更多帮助,请告诉我。我还需要帮助,因为我没有收到问题的解决方案。我在这里重复我想要的。如果我在表格视图中有六行,如果我现在单击4行以检查行,我还需要检查5行和6行,因为我有值,例如0。最后一次检查5行和6行应用程序自动完成用户无法检查第5行和第6行。确定吗?