简单的问题,
我遍历我的表格视图单元格并将对象添加到数组:
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]]];
}
}
Run Code Online (Sandbox Code Playgroud)
只要表格视图只有7个或更少的单元格,如果我添加8个或更多,应用程序就会将此日志崩溃到控制台:
'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
任何帮助是极大的赞赏!