In my app I have a scrollview which has some objects like an imageview, a button etc. and my scrollview has a huge content so I need to scroll vertically or horizontally to explore it. My question is how can I check if an object is located at a visible position on the phone’s screen?
Edit : I want to detect if the image is completely in the scrollView’s frame or not. however CGRectIntersectsRect(bottomScroller.bounds, selectImage_1.frame) returns true even if there is a small intersection.
Compare your object’s (imageview, a button etc.) frame with the
scrollView.bounds:EDIT:
If you want to ensure that the object is fully displayed, then calculate the intersection and compare it to the object’s frame:
although you might found an optimized way to do that check.