Ios 静态/动态内容混合的UITableViewController中的NSRangeException

Ios 静态/动态内容混合的UITableViewController中的NSRangeException,ios,uitableview,uistoryboard,Ios,Uitableview,Uistoryboard,使用iOS6和故事板,我有一个UITableViewController,有3个部分 前两部分是静态的,第三部分是动态的 我已经覆盖了numberOfRowsInSection、CellForRowatineXpath和HeightForRowatineXpath,以便在第0节和第1节中正确地遵从super,并从第2节的数据模型中返回适当的值 尽管如此,当我的数据中的行数超过在故事板中为第三部分配置的行数时,我在main()中仍会遇到NSRangeException: 'NSRangeExcep

使用iOS6和故事板,我有一个UITableViewController,有3个部分

前两部分是静态的,第三部分是动态的

我已经覆盖了
numberOfRowsInSection
CellForRowatineXpath
HeightForRowatineXpath
,以便在第0节和第1节中正确地遵从super,并从第2节的数据模型中返回适当的值

尽管如此,当我的数据中的行数超过在故事板中为第三部分配置的行数时,我在main()中仍会遇到NSRangeException:

'NSRangeException',原因:'***-[\uu NSArrayI objectAtIndex:]:索引1超出范围[0..0]'
***第一次抛出调用堆栈:
(0x22f3012 0x178ae7e 0x22a8b44 0xb0ece4 0x8feee3 0x784f13 0x71940c 0x784a7b 0x7899cf 0x7721bb 0x782b4b 0x71f2dd 0x179e6b0 0x558fc0 0x54d33c 0x54d150 0x4cb0bc 0x4cc227 0x4cc8e2 0x22bba3d 0x22997c2 0x22984F44 0x2298e1b 0x26867e3 0x2686668 0x6ceffc 0x2c4d 0x2b75)
libc++abi.dylib:terminate调用引发异常


为了防止发生此异常,我必须覆盖哪些超类方法?

我缺少的实现是:

-(NSInteger)tableView:(UITableView*)tableView indentationLevelForRowAtIndexPath:(nsindepath*)indepath{
返回0;
}

这意味着要将动态行为注入到静态原型UITableViewController中,必须覆盖总共四种方法:

  • -(NSInteger)tableView:(UITableView*)tableView行数section:(NSInteger)section

  • -(UITableView单元格*)tableView:(UITableView*)tableView单元格for行索引路径:(nsindepath*)indepath

  • -(CGFloat)tableView:(UITableView*)tableView rowatinexpath的高度:(nsindepath*)indepath

  • -(NSInteger)tableView:(UITableView*)tableView indentationLevelForRowAtIndexPath:(nsindepath*)indepath


  • 希望这能节省一些时间。

    天哪,你说得对。我永远也猜不到。在过去的24小时里都有同样的问题,我的头发都被扯下来了。谢谢