在父视图中重写 func point(inside point: CGPoint, with event: UIEvent?) -> Bool
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
if self.bounds.contains(point) {
return true
}
for subView:UIView in self.subviews {
let hitPoint = self.convert(point, to: subView)
if subView.bounds.contains(hitPoint) {
return true
}
}
return false
}