- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
UIView *view = [super hitTest:point withEvent:event];
if (view == nil) {
CGPoint tempoint = [btn convertPoint:point fromView:self];
if (CGRectContainsPoint(btn.bounds, tempoint))
{
view = btn;
}
}
return view;
}
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
var v = super.hitTest(point, with: event)
if v == nil {
let tempPoint = self.imageV.convert(point, from: self)
if self.imageV.bounds.contains(tempPoint){
v = self.imageV
}
}
return v
}
网友评论