iphone - 限制 iPhone 中 UIButton 的可触摸区域?

标签 iphone objective-c ios cocoa-touch

在我看来,我有三个自定义按钮,它们的非矩形图像彼此靠近。然后我遇到了每个按钮的可触摸区域与其他按钮重叠的问题。那么如何限制每个按钮的可触摸区域来获得相应的 Action 呢?

最佳答案

您可以覆盖 -pointInside:withEvent:,它在内部将用于 HitTest 。

使用此技术的一个不错的项目是 OBShapedButton ,其中透明像素不会触发命中。

关于iphone - 限制 iPhone 中 UIButton 的可触摸区域?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8656547/

相关文章:

iOS 应用程序在 iPhone 7 上不使用全屏

ios - 调试错误 xcode 6- 使用 google maps sdk

objective-c - 在UIImageView上绘制UIBezierPath

ios - 是否可以在 UITableView 的部分行中禁用 didSelectRowAtIndexPath?

ios - 快速展开可选值时意外发现 nil

ios - XMPPFramework - 在 iOS 中未收到存在

iphone - MPMoviePlayerController 在连续视频之间产生闪烁

iphone - 在 iPhone 中重新加载 View (在 viewWillAppear 中)

iphone - 如何使用 AVAssetReader 和 AVAssetWriter 来创建 AAC 文件?

ios - 在 Cell 外获取 CollectionViewCell 的 IndexPath