UIButton 触摸事件落入底层视图 [英] UIButton touch event falls through to underlying view

查看:35
本文介绍了UIButton 触摸事件落入底层视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个包含两个 UIButton 的小 UIView.视图响应 UITapGesture 事件.按钮应该响应 TouchUpInside,但是当我点击按钮时,响应者是底层视图并且点击手势选择器被触发.寻求建议或建议.

I have created a small UIView which contains two UIButtons. The view responds to UITapGesture events. The Buttons are supposed to respond to TouchUpInside, however when I tap the buttons the responder is the underlying view and the tap gesture selector is triggered. Looking for advice or suggestions.

推荐答案

视图在视图层次结构中是如何排序的?另外,您是在 IB 中创建接口吗?如果您正确连接连接,这根本不应该是问题...

How are the views ordered in the view hierarchy? Also, are you creating the interface in IB? If you hook up the connections properly, this shouldn't be an issue at all...

这篇关于UIButton 触摸事件落入底层视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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