View事件响应穿透
2018 - 05 - 02
//Only respond child view
open class FallthroughView: UIView {
override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
return subviews.map { [unowned self](v) -> Bool in
let new = v.convert(point, from: self)
return v.point(inside: new, with: event)
}.reduce(false) { $0 || $1 }
}
}