【发布时间】:2016-10-14 11:51:01
【问题描述】:
我的程序因以下报告而崩溃。
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x7fb4e1c099b0'
这是我对 tableview 方法的实现。
崩溃日志here。
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section == 0) {
return 6;
}
return 5;
}
有人知道为什么会这样吗?
【问题讨论】:
-
else if if ????和 section 只是一个,而不是为什么你需要检查 section 是否为 0??
-
你的
tableview总是为numberOfRowsInSection返回 1 -
请分享完整的崩溃日志。
-
我已经修改了上面的代码,显示我只有一个部分,但它仍然崩溃。这是完整的崩溃日志。 gist.github.com/anonymous/283415d293042edc7c00d476df98d774
标签: ios iphone xcode uitableview crash