How to add a view on cell.contentview of uitableview iphone sdk

Posted by neha on Stack Overflow See other posts from Stack Overflow or by neha
Published on 2010-05-10T07:50:34Z Indexed on 2010/05/10 7:54 UTC
Read the original article Hit count: 407

Hi all, In my application I'm creating a .xib of a class and loading that .xib on cells of uitableview of another class. I want to add this .xib to cell.contentView and not cell. How shall I do that?

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString* cellIdentifier = @"testTableCell";

testTableCell * cell = (testTableCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
    [[NSBundle mainBundle] loadNibNamed:@"testTableCell" owner:self options:nil];
    cell = tCell;
}

return cell;
}

testTableCell is my another class in which I have two labels and two buttons, of which I have created a .xib and loading it to tableview's cell as above. tCell is an object of class testTableCell.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk