2015-11-22 32 views
0

我创建的主表视图是使用自定义单元格。现在,我想要在主表视图单元格中显示表视图。此外,内部tableview需要自定义单元格。现在我在单元格中显示表格视图。但我不知道,如何为内部表格视图创建自定义单元格。请帮我解决这个问题定制tableviewcell里面自定义tableviewcell

+0

为您亲代细胞创建自定义单元格明显。你得到什么问题 – Alok

+0

如何在主表格视图单元格中添加nib文件? –

+0

//从自定义单元格XIB加载顶级对象。 NSArray * topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@“yourCustomCell”owner:self options:nil]; //获取一个指向第一个对象的指针(大概是自定义单元格,因为这是所有的XIB应该包含的)。 cell = [topLevelObjects objectAtIndex:0]; – Alok

回答

1

你可以做这样的事情来加载你想要的笔尖。对于电池使用:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BDCustomCell"]; 
if (cell == nil) { 
    // Load the top-level objects from the custom cell XIB. 
    NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"yourCustomCell" owner:self options:nil]; 
    // Grab a pointer to the first object (presumably the custom cell, as that's all the XIB should contain). 
    cell = [topLevelObjects objectAtIndex:0]; 
} 

return cell; 

}

希望它有助于

+0

pleae接受,如果它帮助 – Alok