美文网首页
UITableViewCell UIButton不响应点击事件

UITableViewCell UIButton不响应点击事件

作者: iOS开发小学生 | 来源:发表于2021-05-20 17:16 被阅读0次

今天记录一下这个问题,由于iOS14API已经更新,所以之前的写法已经不响应了。
之前cell添加button的方法

[cell addSubview: button];

iOS 14以后要修改成
1、使用如下方法:

[cell.contentView addSubview: button]

在没请教大神这个问题的时候,困扰了我两个小时,我是各种方法添加和查找······

相关文章

网友评论

      本文标题:UITableViewCell UIButton不响应点击事件

      本文链接:https://www.haomeiwen.com/subject/jqdbjltx.html