问题描述
我将UIButton
放在UITableViewCell
上,并将其showsTouchWhenHighlighted
属性设置为YES
.单元格的选择样式为UITableViewCellSelectionStyleNone
.我有一个选择器,当点击该按钮并且其工作正常时,它会被调用,因此该按钮可以很好地实现触摸事件.但是,触摸时按钮不显示突出显示效果.
I put a UIButton
on a UITableViewCell
and set its showsTouchWhenHighlighted
property to YES
. The cell's selection style is UITableViewCellSelectionStyleNone
. I have a selector that gets called when the button is tapped and it's working fine, so the button is getting the touch events fine. However, button doesn't show the highlight effect when touched.
当我将此按钮放在UIView
上时,突出显示效果起作用.
When I put this button on a UIView
, the highlight effect works.
将按钮放在单元格上时,如何使这项工作正常?
How can I make this work when the button is placed on the cell?
推荐答案
您需要在表视图上将'delaysContentTouches'设置为NO
You need to set 'delaysContentTouches' to NO on the Table View
这篇关于当按钮位于UITableViewCell上时,UIButton为什么showTouchWhenHighlighted不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!