Last active
June 19, 2017 12:24
-
-
Save yoxisem544/81ee8f0b32cec5fc83c70749f0c24e19 to your computer and use it in GitHub Desktop.
This file contains 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
import UIKit | |
final public class HitTestExtendedView: UIView { | |
public weak var reciever: UIView? | |
public convenience init(withWidth: CGFloat, andRecieverView r: UIView?) { | |
self.init(frame: CGRect(origin: CGPoint.zero, size: CGSize(width: withWidth, height: withWidth))) | |
self.reciever = r | |
} | |
fileprivate override init(frame: CGRect) { | |
super.init(frame: frame) | |
} | |
required public init?(coder aDecoder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") | |
} | |
public override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { | |
return (self.point(inside: point, with: event) ? reciever : nil) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment