erb dinesh
erb dinesh

Reputation: 111

custom tableviewcell inside custom tableviewcell

I created main table view be using custom cell. Now, I want show table view inside main table view cell.Also, Inner tableview need custom cell. Now I show table view inside a cell. but i don't know, how to create custom cell for inner table view. Kindly help me to solve this problem

Upvotes: 0

Views: 45

Answers (1)

maddy
maddy

Reputation: 4111

You can do something like this to load nib where ever you want. For cell use this:

- (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;

}

hope it helps

Upvotes: 1

Related Questions