ios - 关于UIButton 的点击响应问题
PHP中文网
PHP中文网 2017-04-17 15:08:27
0
2
691

如图,我将右上角的UIButton 添加到里面的白色的UIView上面,可以看出来这个button有部分是在UIView外面的。我代码是:
[contentView addSubview:button]; [button addTarget:self selector......]
现在问题就是,button在这个白色view外面的部分不能响应点击事件,只有在白色view内部的4/1圆里面可以接收到点击时间。我想让button整个都能收到点击事件。该怎么破

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
大家讲道理

The first method is to put your display animation and cross button into a view, and add the button to the view; the second method is to reset the hotspot area of ​​your contentview

小葫芦

The current problem is that the superview area of ​​button is too small and blocks the response of the button. Just lift the button above it. There are many solutions.

You can add button to contentView.superview, but you need to reset button.frame.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template