繁体   English   中英

在“ UITableViewCell *”类型的对象上找不到属性

[英]Property not found on object of type 'UITableViewCell *'

在我的xcode项目上工作时出现此错误

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
  static NSString *CellIdentifier = @"DateTimeCell1";
  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];

  if (cell == nil)
  {
    cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle
                                 reuseIdentifier:@"cell" ];
  }


  NSString *sysDeliveryType=[[jsonData objectAtIndex:indexPath.row]valueForKey:@"sysord_DeliveryType"];
  NSString *sysExpDeliveryTime=[[jsonData objectAtIndex:indexPath.row]valueForKey:@"sysord_ExpectedDeliveryTime"];
  NSString *sysOrderDateTime=[[jsonData objectAtIndex:indexPath.row]valueForKey:@"sysord_OrderDateTime"];
  NSLog(@"%@",sysDeliveryType);
  cell.lblDeliveryPickUP.text=sysDeliveryType;
  cell.lblexpDeliveryTime.text=sysExpDeliveryTime;
  cell.lblsysOrderPlacedTime.text=sysOrderDateTime;
  return cell;
}

也正确给出了outlate,但是未在我的代码中显示此错误的属性

您需要将cell DateTimeCellDateTimeCell

例如: [[(DateTimeCell *)cell lblDeliveryPickUP] setText:sysDeliveryType];

您尝试设置的标签没有UITableViewCell属性。

声明单元格为所需的类型,并为出队方法提供正确的标识符。

DateTimeCell1 * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM