我正在尝试将一些数据从数组加载到tableView中,但是唯一的图像会加载。那里有代码:
SELECT distinct substring(EI_BodyNText, CHARINDEX('IATACarrierCode</Type><Value>', EI_BodyNText)+29, 2) from dbo.EDIInterchange
我错过了什么?
答案 0 :(得分:2)
您的return cell;
行是在将任何文字分配给其标签之前。分配文本后,将此行移动到某个位置。
答案 1 :(得分:0)
从以下位置移开代码行return cell;
cell.imageCar.image = [UIImage imageNamed:[[_arrayCars objectAtIndex:indexPath.row]objectForKey:@"logo"]];
return cell;
cell.lblName.text = [[_arrayCars objectAtIndex:indexPath.row]objectForKey:@"name"];
到:
cell.imageCar.image = [UIImage imageNamed:[[_arrayCars objectAtIndex:indexPath.row]objectForKey:@"logo"]];
cell.lblName.text = [[_arrayCars objectAtIndex:indexPath.row]objectForKey:@"name"];
cell.lblHP.text = [[_arrayCars objectAtIndex:indexPath.row]objectForKey:@"horse_power"];
cell.lblPrice.text = [[_arrayCars objectAtIndex:indexPath.row]objectForKey:@"price"];
return cell;
它将解决您的问题。
答案 2 :(得分:0)
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
CarsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
if(cell == nil){
cell = [[NSBundle mainBundle]loadNibNamed:@"CarsTableViewCell" owner:self options:nil][0];
}
cell.imageCar.image = [UIImage imageNamed:[[_arrayCars objectAtIndex:indexPath.row]objectForKey:@"logo"]];
return cell;
cell.lblName.text = [[_arrayCars objectAtIndex:indexPath.row]objectForKey:@"name"];
cell.lblHP.text = [[_arrayCars objectAtIndex:indexPath.row]objectForKey:@"horse_power"];
cell.lblPrice.text = [[_arrayCars objectAtIndex:indexPath.row]objectForKey:@"price"];
return cell;
}