我写了一个继承自UITableViewController的子类,其中一个函数会导致程序一启动就挂掉。我把那个函数给注释掉程序就不会出错了,那个函数是:
- C/C++ code
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [[masterColorList objectAtIndex:section] count]; }
------解决方案--------------------
[masterColorList objectAtIndex:section]
section 应该超过了 masterColorList 的 count,
做个测试。
还有个函数,numberOfSections 你返回的是多少。
------解决方案--------------------
先问楼主怎么得到的section的多少的????把这个问题解决了后面的就好办了,还有一点,在加载TableView的内容时你的masterColorList不因该有其他操作!
------解决方案--------------------
[masterColorList objectAtIndex:section] 要打印出来看看