Add button to UITableViewCell

前端 未结 5 1664
一个人的身影
一个人的身影 2021-02-03 15:07

I want to add a button in a UITableViewCell. This is my code: `

if (indexPath.row==2) {
    UIButton *scanQRCodeButton = [[UIButton alloc]init];

           


        
5条回答
  •  深忆病人
    2021-02-03 16:09

    Method setTitle does not work in my code, so I have set by using

    [UIButton.titleLabel setText:@""]
    

    instead of using setTitle method.

    Please try again with following code:

    [scanQRCodeButton.titleLabel setText:@"Hello"];
    

    Then it would work well.

提交回复
热议问题