Last active
May 10, 2022 01:45
-
-
Save hlung/b65b50a61e568e9c967a6379573dec29 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Put this in a UITableViewCell or UICollectionViewCell subclass. | |
// Returns nil if point is not within the specified subviews. | |
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { | |
let subviews = [imageView, titleLabel, detailLabel, downloadButton] | |
for view in subviews { | |
if view.convert(view.bounds, to: self).contains(point) { | |
return super.hitTest(point, with: event) | |
} | |
} | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment