NSMutableArray *arr1 = [NSMutableArray array];
for (int i=1; i<=100; i++)
{
[arr1 addObject:[NSNumber numberWithInt:i]];
}
self._index = 0;
[self Out:arr1 startIndex:0];
- (void) Out:(NSMutableArray *)arr1 startIndex:(NSInteger)index
{
NSInteger nTotalIn = [arr1 count];
if (nTotalIn >= 7)
{
NSNumber *n1;
if ((index+6) <= (nTotalIn-1))
{
n1 = [arr1 objectAtIndex:index+6];
index += 6;
}
else
{
n1 = [arr1 objectAtIndex:index+6-nTotalIn];
index = index+6-nTotalIn;
}
NSLog(@"%d\n",n1.intValue);
[arr1 removeObjectAtIndex:index];
[self Out:arr1 startIndex:index];
}
else
{
NSLog(@"done!\n");
}
}