Is there a way to identify whether UIView hides/overlaps another UIView by checking points/pixels?
UIView intersect
If your views are rectangular, just test if their frames intersect.
Use
func intersects(_ rect2: CGRect) -> Bool
To know if it overlaps, test if rect2 in included in rect1
func contains(CGRect) -> Bool
Use
func intersects(_ rect2: CGRect) -> Bool
Code Block let intersect = rect1.intersects(rect2)
To know if it overlaps, test if rect2 in included in rect1
func contains(CGRect) -> Bool
Code Block let contained = rect1.contains(rect2)
Did this solve your issue ?
If so, don't forget to close the thread. If not, please explain what the problem is.
If so, don't forget to close the thread. If not, please explain what the problem is.
Did you solve or did you give up ?