From 29a3a4a3a34b6d43ff66bfb79330357713a6dff9 Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Mon, 6 May 2024 18:46:19 -0400 Subject: [PATCH] Digital ACT191 story ONEAPP-7718 - Changed to allow sub uicontrols to take hits. --- VDS/Components/TileContainer/TileContainer.swift | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/VDS/Components/TileContainer/TileContainer.swift b/VDS/Components/TileContainer/TileContainer.swift index 314b16b8..b4b62ab1 100644 --- a/VDS/Components/TileContainer/TileContainer.swift +++ b/VDS/Components/TileContainer/TileContainer.swift @@ -108,9 +108,7 @@ open class TileContainerBase: Control where Padding $0.clipsToBounds = true } - private var containerView = View().with { - $0.isUserInteractionEnabled = false - } + private var containerView = View() //-------------------------------------------------- // MARK: - Public Properties @@ -119,9 +117,7 @@ open class TileContainerBase: Control where Padding open var backgroundImage: UIImage? { didSet { setNeedsUpdate() } } /// This is the container in which views will be pinned. - open var contentView = View().with { - $0.isUserInteractionEnabled = false - } + open var contentView = View() /// This is the view used to show the high light color for a onClick. open var highlightView = View().with { @@ -271,6 +267,14 @@ open class TileContainerBase: Control where Padding clipsToBounds = true } + /// Overriden to take the hit if there is an onClickSubscriber and the view is not a UIControl + open override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { + let view = super.hitTest(point, with: event) + guard let _ = onClickSubscriber else { return view } + guard view is UIControl else { return self } + return view + } + /// Resets to default settings. open override func reset() { super.reset()