2012-06-04 4 views

답변

1

귀하의 아이디어가 정확하다고 생각합니다. 그것은 나를 있었다면 내가 다음과 같이 할 것 :

//scrollView is the main scroll view 
//mainview is scrollview.superview 
//view is the view inside the scroll view 

CGRect viewRect = view.frame; 
CGRect mainRect = mainView.frame; 

if(CGRectIntersectsRect(mainRect, viewRect)) 
{ 
    //view is visible 
} 
5

이 스크롤 뷰 위임에 scrollViewDidScroll:를 구현하고 뷰를 선택하여 예 (볼 수있는 수동으로 계산 CGRectIntersectsRect(scrollView.bounds, subview.frame) true를 반환

15

당신이하려는 경우합니다. 뷰가 화면에 스크롤 된 경우 해결하려면 다음을 수행하십시오

CGRect thePosition = myView.frame; 
    CGRect container = CGRectMake(scrollView.contentOffset.x, scrollView.contentOffset.y, scrollView.frame.size.width, scrollView.frame.size.height); 
    if(CGRectIntersectsRect(thePosition, container)) 
    { 
     // This view has been scrolled on screen 
    } 
0

은 빠른 3

var rect1: CGRect! 
// initialize rect1 to the relevant subview 
if rect1.frame.intersects(CGRect(origin: scrollView.contentOffset, size: scrollView.contentSize)) { 
     // the view is visible 
    } 
업데이트
관련 문제