https://juejin.cn/post/6844903647306874888
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
if !self.point(inside: point, with: event) {
if let contentV = subviews.last?.subviews.last {
for view in contentV.subviews {
if view == rightImgView {
let point2 = convert(point, to: view)
// 看准位置是frame或者bounds
if CGRectContainsPoint(view.bounds, point2) {
return view
}
}
}
}
}
return super.hitTest(point, with: event)
}
网友评论