あなたの問題を理解していることを確認するために、あなたUICollectionView
は黄色とUIbutton
ピンクを持っていますよね?
もしそうなら、黄色のボタンのスーパービューの外にある touchUpInside イベントをインターセプトしたいようです。ある種の問題を扱うこの回答を見ることができます。
最終的に問題の解決策を見つけたとしても、私の答えを明確にするために、スーパービューのフレーム内にない とやり取りしたい場合は、スーパービューUIButton
のメソッドを実装する必要があるかもしれません- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
(ここではUICollectionViewCell
):
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
if (!self.clipsToBounds && !self.hidden && self.alpha > 0) {
for (UIView *subview in self.subviews.reverseObjectEnumerator) {
CGPoint subPoint = [subview convertPoint:point fromView:self];
UIView *result = [subview hitTest:subPoint withEvent:event];
if (result != nil) {
return result;
}
}
}
return nil;
}
(ノームさんありがとう!)