Visual_Novel_iOS/crush/Crush/Src/Components/UI/BaseView/SelectiveDeliveryEventsView...

32 lines
1.0 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// SelectiveDeliveryEventsView.swift
// Crush
//
// Created by Leon on 2025/7/27.
//
import UIKit
/// ViewControl
class SelectiveDeliveryEventsView: UIView {
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
// 1. view nil
if self.isHidden || self.alpha < 0.01 || !self.isUserInteractionEnabled {
return nil
}
// 2. UIControl
for subview in subviews.reversed() {
let convertedPoint = subview.convert(point, from: self)
if let hitView = subview.hitTest(convertedPoint, with: event) {
if hitView is UIControl {
return hitView //
}
}
}
// 3. nil
return nil
}
}