Add button to UITableViewCell's Accessory View

前端 未结 10 1932
没有蜡笔的小新
没有蜡笔的小新 2021-01-01 16:41

Goal: when a user selects a cell, a button is added to that cell. Within my didSelectRowAtIndexPath function I have the following:

UIButton *downloadButton =         


        
10条回答
  •  無奈伤痛
    2021-01-01 17:33

    let button = UIButton(type:.roundedRect)
    button.setTitle("A", for: .normal)
    button.sizeToFit()
    cell.accessoryView = button
    

提交回复
热议问题