我有2個tableViews,第一個只從數組加載列表。 其他1,每行顯示詳細信息。但它顯示了一個崩潰報告:多個UITableViewCells每行不同的字段
「的UITableView數據源必須的tableView返回細胞:的cellForRowAtIndexPath:異常」
出了什麼錯我的代碼?我想要顯示每行來自同一個sqlite行的不同細節。
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell;
//tableView 1
if(tableView == self.cTableLabel)
{
cell = [tableView dequeueReusableCellWithIdentifier:@"courseCell"];
NSLog(@"Here.");
Course *courses = [self.course objectAtIndex:indexPath.row];
cell.textLabel.text =courses.cName;
cell.detailTextLabel.text =courses.cSchool;
return cell;
}
//tableView 2
if(tableView == self.jTableLabel)
{
if (indexPath.row == 0)
{
cell = [tableView dequeueReusableCellWithIdentifier:@"JobName"];
cell.textLabel.text = _jDetails.jName;
}
else if (indexPath.row == 1)
{
cell= [tableView dequeueReusableCellWithIdentifier:@"JobEarnings"];
cell.textLabel.text = @"Job Earnings (per month): Php";
cell.detailTextLabel.text = _jDetails.jEarnings;
}
return cell;
}
return 0;
}
它沒有命中斷點。 :\ n也沒有NSLog – hazelvan
嗯..那麼哪個返回語句碰到了? – ansible