gpt4 book ai didi

swift - 无法单击 iOS 14 中 UITableViewCell 内的按钮

转载 作者:行者123 更新时间:2023-12-03 09:20:11 24 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





Selectable objects on UITableViewCell not responding to user input on iOS14

(1 个回答)


10 个月前关闭。




在 iOS 13 中,它运行良好,但我无法在 TableViewCell 中对按钮进行简单的点击。它发生在别人身上吗?这样做的方式改变了吗?

最佳答案

解决了!
您必须像这样将 View 添加到单元格 contentView 中:

contentView.addSubview(button)
并将您的按钮 anchor 定到 contentView:
button.topAnchor.constraint(equalTo: contentView.topAnchor).isActive = true

关于swift - 无法单击 iOS 14 中 UITableViewCell 内的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63951388/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com