0
代碼:for循環editingStyleForRowAtIndexPath執行一次
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(INT sectieId = 0; sectieId < [自pickAnd]計數]; sectieId ++)
'return'退出當前的方法或函數。你認爲它應該做什麼? (也請注意,您正在修改循環控制變量,這可能會導致意外的結果。) –
如何將此for-loop轉換爲與此特定的for-loop執行相同操作的內容?我有不同數量的部分,所以我需要一些for-loop .. – Fuzej
你是什麼意思「這個特定的for-loop」?你究竟想要發生什麼? –