0

テーブルビューにボタンを追加しようとしていますが、どのフレームを指定してもボタンが表示されません。これはカスタム UITableViewCell であり、ボタンをクリックして didSelectRowAtIndexPath ではないアクションを実行できるように、xib ファイルではなくコードにボタンを追加しています: 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 に答える