for循环在editingStyleForRowAtIndexPath中只执行一次

时间:2012-11-14 16:46:06

标签: objective-c ios for-loop tableview

代码:

if(self.editing == YES)
{
    if(self.editing == YES && indexPath.section == 7 && indexPath.row == [[self pickGoalsFromAnd:0] count])
    {   
        NSLog(@"INSERT editingStyleForRowAtIndexPath.section: %d", (indexPath.section));
        return UITableViewCellEditingStyleInsert;
    }
    NSLog(@"Net voor FORLUS");
    for(int sectieId = 0; sectieId < [[self pickAnd] count]; sectieId++)
    {

        NSLog(@"Binnen FORLUS , sectieId/pickAndCount: (%d)/(%d)", sectieId, [[self pickAnd] count]);

        sectieId = sectieId + 8;
        NSLog(@"indexPath.section '==' %d '&&' indexPath.row '==' %d", sectieId , [[self pickGoalsFromAnd:(sectieId-8)] count]  );

                    if(indexPath.section == sectieId && indexPath.row < [[self pickGoalsFromAnd:(sectieId-8)] count])
                    {
                        NSLog(@"INSERT editingStyleForRowAtIndexPath.section: %d", (indexPath.section));
                    return UITableViewCellEditingStyleInsert;
                    }
                    else 
                        if(indexPath.section != ([[self pickAnd] count] + 7))
                        {
                    {
                        NSLog(@"ifELSE");
        return UITableViewCellEditingStyleDelete;
                    }
                        }
    }

正如我所看到的,使用NSLogs,for循环只执行一次。 for循环在'返回'时会停止吗?

for循环:for(int sectieId = 0; sectieId&lt; [[self pickAnd] count]; sectieId ++)

1 个答案:

答案 0 :(得分:1)

一旦你返回,你退出该功能并且lopp中断,这就是为什么它只执行一次。