gpt4 book ai didi

iOS:如何将触摸事件从 subview 转发到父 View ?

转载 作者:可可西里 更新时间:2023-11-01 05:40:36 26 4
gpt4 key购买 nike

<分区>

我的 iPhone 项目中有以下设置(一个有 UIView 作为 subview 的 UIButton):

- UIButton       // super-view   <-------|
| <touch-event>
|_ UIView // sub-view ________|

我已使用 IB 将我的 UIButton 中的一个 Action (内部修饰)连接到我的 View Controller 。但不幸的是,UIView 阻止操作系统调用我的 UIButton 的操作方法,因为 UIView subview 不响应触摸,因此不转发到它的 super View 。

如何将操作事件从 UIView 转发到 super View UIButton ?从而使 UIButton“认为”它已被触摸,尽 pipe View 已被触摸。

我已经找到了这些链接,但它们对我没有帮助:

Objective-C 中的一些代码示例会很棒!

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