2015-11-22 35 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