-3
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (tableView == method) {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *methodcell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(methodcell == nil){
methodcell = [[UITableViewCell alloc]initWithStyle:UITableViewStylePlain reuseIdentifier:CellIdentifier];
}
methodcell.textLabel.text = [methodarray objectAtIndex:indexPath.row];
return methodcell;
}
else if (tableView == schedule){
static NSString *CellIdentifier = @"Cell";
UITableViewCell *schedulecell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(schedulecell == nil){
schedulecell = [[UITableViewCell alloc]initWithStyle:UITableViewStylePlain reuseIdentifier:CellIdentifier];
}
schedulecell.textLabel.text = [ScheduleArray objectAtIndex:indexPath.row];
return schedulecell;
}
}
這是我見過的最糟糕的錯誤描述,請詳細說明。 – 2014-08-29 06:55:04
由於未返回單元而導致錯誤。在方法的末尾添加'return nil'並且錯誤將消失,但是請注意,如果這些if語句沒有通過您的應用程序將會崩潰。 – sbarow 2014-08-29 06:56:11
謝謝sbarow。 – 2014-08-29 07:00:28