override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
let offset = -20
let viewFrame = subView.frame.inset(by: UIEdgeInsets(top: offset, left: offset, bottom: offset, right: offset))
if viewFrame.contains(point) {
return subView
}
return super.hitTest(point, with: event)
}
Swift 在父控件上给子控件拓展点击区域
于 2022-11-04 17:43:05 首次发布