2009-09-19 34 views

回答

1

回調選擇添加到您的動畫:

[UIView beginAnimations:nil context:NULL]; 
    [UIView setAnimationDuration:0.5]; 
    [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:theView cache:NO]; 
    [UIView setAnimationDidStopSelector:@selector(animationDone)]; 
    theView.frame = newFrame; 
    [UIView commitAnimations]; 
+0

哎呦, 我現在意識到我給了一個誤導性的印象,這是一個動畫,在這種情況下,你的答案將會死亡。我的錯。其實「窗口」是我們的朋友UIScrollView。我看過UIScrollView和UIScrollViewDelegate方法,似乎沒有任何東西符合法案。 – dugla 2009-09-20 00:07:26

2

在你UIScrollViewDelegate:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView { 
    // left and right bounds of the subview in relation to the scrollview 
    CGFloat left = mySubview.frame.origin.x - myScrollView.contentOffset.x; 
    CGFloat right = left+mySubview.frame.size.width - myScrollView.contentOffset.x; 
    if(right<=0 || left>=myScrollView.frame.size.width){ 
     // The view is not visible 
    } 
} 

這種檢查無論是子視圖的左側或右側可見。