UITableView subview to uitableviewcell
Posted
by Dave
on Stack Overflow
See other posts from Stack Overflow
or by Dave
Published on 2010-04-19T18:41:38Z
Indexed on
2010/04/19
18:43 UTC
Read the original article
Hit count: 315
i am trying to add a button to the tableview and no matter what frame i specify the button is not visible. This is a custom UITableViewCell and I am adding the button in the code rather than in the xib file is so that I can click on the button and perform an action which is not didSelectRowAtIndexPath: I have the following code in cellForRowAtIndexPath: What am I missing?
UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
button.titleLabel.text = @"detail";
button.frame = bframe;
button.userInteractionEnabled = YES;
[button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubview:button];
return cell;
© Stack Overflow or respective owner