0

我正在尝试向 tableview 添加一个按钮,无论我指定什么框架,按钮都不可见。这是一个自定义 UITableViewCell,我在代码中而不是在 xib 文件中添加按钮,以便我可以单击按钮并执行不是 didSelectRowAtIndexPath 的操作:我在 cellForRowAtIndexPath 中有以下代码:我错过了什么?

UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    button.frame = bframe;
    button.userInteractionEnabled = YES;
    [button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
    [cell.contentView addSubview:button];
    return cell;
4

1 回答 1

0

尝试这个

UIButton *button = [[UIButton buttonWithType:UIButtonTypeDetailDisclosure] 保留];

于 2010-04-19T19:01:20.383 回答