【发布时间】:2013-09-26 04:25:05
【问题描述】:
此代码块在 Xcode 4.6 中完美运行,但在 Xcode5/IOS7 中不再适用。
在静态表中,节中的行是否可见(连同节标题)取决于 ID 行。如果以下代码被注释掉,视图控制器将加载,否则会生成:由于未捕获的异常 'NSRangeException' 导致应用程序终止,原因:'* -[__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
视图控制器是一个 UITableView,除了 numberOfRowsInSection 之外的所有内容都被注释掉了。
任何想法如何恢复此功能?
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if(section == 1)
{
if(ID == 1) return 0;
else return 1;
}
else return 2;
}
谢谢
解决了!!!将“else return 2”替换为:
else return [super tableView:tableView numberOfRowsInSection:section];
【问题讨论】:
标签: ios xcode uitableview ios7 xcode5