简单的问题,
我循环遍历我的表格视图单元并将对象添加到数组中:
NSMutableArray *cells = [[NSMutableArray alloc] init];
for (NSInteger j = 0; j < [self.ammoTable numberOfSections]; ++j) // loop thru sections
{
for (NSInteger i = 0; i < [self.ammoTable numberOfRowsInSection:j]; ++i)//in each section loop thru the cells
{
[cells addObject:[self.ammoTable cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:j]]];
}
}
这很完美,只要表格视图只有 7 个或更少的单元格,如果我添加 8 个或更多单元格,应用程序就会崩溃,并将此日志记录到控制台:
'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
任何帮助是极大的赞赏!