Add button to UITableViewCell's Accessory View

前端 未结 10 1880
没有蜡笔的小新
没有蜡笔的小新 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:18

    I had the same problem. Attempting to set the accessoryView to a UIButton which had an image caused it to not appear.

    The trick was to call [UIButton sizeToFit], to ensure its frame is set properly.

提交回复
热议问题