首先,对不起我的英语,我是法国人:)
就像标题中所说的那样,我想在 ipad 上的一个简单的 tableview 中放置一个自定义 tableviewcell。这是必要的,因为我想生成一个带有 5 个标签的表格。
UITableViewCell
我使用带有 NIB的单独类。
这是我的代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CellIdentifier";
CustomTableCell *cell = (CustomTableCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
[[NSBundle mainBundle] loadNibNamed:@"CustomTableCell" owner:self options:nil];
cell = customTableCell;
self.customTableCell = nil;
}
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
[self configureCell:cell atIndexPath:indexPath];
NSString *rowLabelEcheance = [[NSString alloc] initWithFormat:@"%@", [contentsList objectAtIndex:indexPath.row]];
[customTableCell.labelEcheance setText:rowLabelEcheance];
NSString *rowLabelCapitalRestantDu = [[NSString alloc] initWithFormat:@"%@", >>>>>>> [contentsList2 objectAtIndex:indexPath.row]];
[customTableCell.labelCapitalRestantDu setText:rowLabelCapitalRestantDu];
NSString *rowLabelInterets = [[NSString alloc] initWithFormat:@"%@", [contentsList3 objectAtIndex:indexPath.row]];
[customTableCell.labelInterets setText:rowLabelInterets];
NSString *rowLabelAmortissement = [[NSString alloc] initWithFormat:@"%@", >[contentsList4 objectAtIndex:indexPath.row]];
[customTableCell.labelAmortissement setText:rowLabelAmortissement];
NSString *rowLabelMontant = [[NSString alloc] initWithFormat:@"%@", [contentsList5 objectAtIndex:indexPath.row]];
[customTableCell.labelMontant setText:rowLabelMontant];
return cell;
}
你能帮助我吗 ?我花了8个小时来解决这个问题......
谢谢 !