当按钮位于UITableViewCell上时,UIButton为什么showTouchWhenHighlighted不起作用? [英] Why doesn't UIButton showsTouchWhenHighlighted work when the button is on a UITableViewCell?

查看:65
本文介绍了当按钮位于UITableViewCell上时,UIButton为什么showTouchWhenHighlighted不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将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不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆