gpt4 book ai didi

objective-c - 在 UIViewController 中接收 UITableViewCell 的 TouchesBegan

转载 作者:行者123 更新时间:2023-11-28 19:17:40 24 4
gpt4 key购买 nike

如何从 UITableViewController 中的 UITableViewCell 接收 TouchesBegan,以便我知道用户何时触摸了某个单元格?

最佳答案

当您触摸 a 单元格时,它会高亮显示;尝试覆盖 UITableViewCell 的子类中的 setHighlighted: 以在它更改为 YES(用户触摸)或 NO(用户抬起)时调整您的外观。

(重写 touchesBegan:withEvent: 也可以,但是使用 setHighlighted: 更容易,以便在您不再触摸时进行捕捉;否则您需要覆盖 touchesEnded:withEvent:touchesCancelled:withEvent:)。

关于objective-c - 在 UIViewController 中接收 UITableViewCell 的 TouchesBegan,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11195442/

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