开发者

UITableView subview to uitableviewcell

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.frame = bframe;
    button.userInteractionEnabled = YES;
    [button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
    [cell.cont开发者_高级运维entView addSubview:button];
    return cell;


try this

UIButton *button = [[UIButton buttonWithType:UIButtonTypeDetailDisclosure] retain];

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜