ios – Different method to test intersect scrollview subview body Swift

[ad_1]

Presently i am following the beneath code to test the 2 CGRect Body intersects.

Code:-

var visibleRect = CGRect.init(x: 0, y: 0, width: 0, top: 0)
visibleRect.origin =   scrollView.contentOffset
visibleRect.dimension   =   scrollView.bounds.dimension

if !visibleRect.intersects(ImagView.body) { 
     print("Outer View")
}else{
     print("Internal View")     
}

This code works When ImagView body goes completely out of visibleRect. However we want when imageview body origin near scrollview body origin. Extra element Please test the display screen shot.

Second Screenshot

When the automobile transfer out from the display screen the above code working completely. However we want when automobile close to to shut out from the scrollview body.

Query: Can somebody please clarify to me tips on how to get close to to shut out?

Any assist can be significantly appreciated.

Thanks prematurely.

[ad_2]

Leave a Reply