我设计了一个UItableView,为此我已经用文本字段进行了单元格自定义,在执行这个程序的过程中我得到了空白文本字段。我试过cellname.textfieldname.enable = NO,但它仍显示空白值?
这是我的代码:
{
static NSString *CellIdentifiers=@"Cell";
RemovedEquip *eqp = [tblArry objectAtIndex:indexPath.row];
CustomcelliPad *cell = (CustomcelliPad *)[tableView dequeueReusableCellWithIdentifier:CellIdentifiers];
if (cell == nil)
{
NSArray *array=[[NSBundle mainBundle] loadNibNamed:@"CustomcelliPad" owner:self options:nil];
cell=(CustomcelliPad *)[array objectAtIndex:0];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.removedequipment_txt.font=[UIFont fontWithName:@"Bordeaux Medium" size:13.0];
cell.removedequipment_txt.text=[[tblArry objectAtIndex:indexPath.row] objectForKey:@"RemovedEquipmentDescription"];//Here I'm getting the text from an array.
return cell;
}
感谢您的帮助
答案 0 :(得分:0)
放置NSLog
并查看您在控制台中获取的值
[[tblArry objectAtIndex:indexPath.row] objectForKey:@"RemovedEquipmentDescription"];
如果该值存在,那么它应显示,如果没有,则检查在呈现表视图之前是否填充了数组,如果在加载视图后构建数组,则需要重新加载表格视图数据。只需在阵列构建完成后放置此行 -
[myTableView reloadData];
它应该可以正常工作。