2013-04-25 29 views
0

我想移動我的UISCrollView的ContentOffset。我使用不同的方法,CABasicAnimation或UIView animateWithDuration,但問題是,在動畫過程中,我的UIScrollView從右側和左側剪切。UIScrollView在動畫過程中剪輯

當動畫完成時,UIScrollView的大小似乎是正確的。

- (void)animateScrollToTheBottom { 

    self.scroll.scrollEnabled = NO; 

    CGFloat scrollHeight = self.scroll.contentSize.width; 

    [UIView animateWithDuration:10 
         delay:0 
         options:UIViewAnimationCurveEaseInOut | UIViewAnimationOptionBeginFromCurrentState 
     animations:^{ 

     self.scroll.contentOffset = CGPointMake(0, scrollHeight); 

    } completion:^(BOOL finished) { 

     self.scroll.scrollEnabled = YES; 

    }]; 
} 

有什麼建議嗎?謝謝!

+0

你嘗試self.scroll.clipToBounds = NO? – 2013-04-25 10:34:52

+0

謝謝阿維!尼斯,現在我消除了正確的剪輯...現在我可以調查與是 – 2013-04-25 10:44:52

+0

Avi,我認爲我將UIScrollView外屏移動到左側,但我不明白爲什麼。如果我不調用動畫,則Scroll正確地安裝在屏幕上。 – 2013-04-25 10:53:05

回答

0
[UIView animateWithDuration:5.0f animations:^ { 
    [scrollView setContentOffset:destination animated:NO]; 
}]; 

工作對我來說

+0

Thanbks Lithu,我認爲我有一些問題,UIScrollView的界限......我試圖找到它;) – 2013-04-25 10:50:35