click event for the button is happening even below the buttons which should not happen
Assistant
You're encountering an issue where touch events for the buttons are being triggered even when tapping below them, which is not the intended behavior.
🧠 Root Cause:
This usually happens because of how UIView hit-testing and layout constraints work. Even though visually the buttons may appear constrained within a specific area, if their parent views (like secureView) or constraints aren't configured properly to restrict interaction, touches can be passed through or misinterpreted.
✅ Solution:
🔍 1. Ensure Buttons Are Confined Properly
Make sure that the buttonStackView has a defined height and that it's pinned correctly so no overflow occurs.
🔒 2. Prevent Touches from Passing Through Below the Buttons
If you're seeing tap events firing even below the buttons, it could be that the tableView is intercepting touch events meant for other areas or there's an issue with the hierarchy.
To fix this, make sure your secureView doesn't allow overlapping interactions:
Add this line to prevent subviews from receiving unintended touches:
swift
secureView.clipsToBounds = true
Also, ensure isUserInteractionEnabled = true on all relevant views (especially secureView, buttonStackView, and the buttons themselves).
🧹 3. Clean Up Any Overlapping Layers
Before re-adding the secureView, make sure to remove any existing one to avoid stacking multiple overlays: