Skip to content

Instantly share code, notes, and snippets.

@Oni-zerone
Created August 9, 2017 08:17
Show Gist options
  • Save Oni-zerone/8dd5f0f18af3d8723ae48f7275afbecd to your computer and use it in GitHub Desktop.
Save Oni-zerone/8dd5f0f18af3d8723ae48f7275afbecd to your computer and use it in GitHub Desktop.
//
// TouchLayerView.swift
//
//
// Created by Oni_01 on 04/01/15.
// Copyright (c) 2015 Andrea Altea. All rights reserved.
//
import UIKit
class TouchLayerView: UIView {
weak var transparentLayer:UIView?
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
let hitView = super.hitTest(point, with:event)!
if let layer = transparentLayer {
if hitView != layer && hitView.isDescendant(of: layer) {
return hitView
}
}
return nil
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment