// // MBContentView.m // LNManager // // Created by EchoShacolee on 2017/5/3. // Copyright © 2017年 lee. All rights reserved. // #import "MBContentView.h" @implementation MBContentView -(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { UIView *view = [super hitTest:point withEvent:event]; if (view == nil) { for (UIView *subView in self.subviews) { CGPoint myPoint = [subView convertPoint:point fromView:self]; if (CGRectContainsPoint(subView.bounds, myPoint)) { for (UIButton * button in subView.subviews) { CGPoint myPoint2 = [button convertPoint:myPoint fromView:subView]; if (CGRectContainsPoint(button.bounds, myPoint2)) { return button; } } } } } //打开的话 点击按键周围有效 // if (view == self) { // return self.superview.subviews[0]; // } return view; } @end