【发布时间】:2013-04-25 10:28:35
【问题描述】:
我想移动 UISCrollView 的 ContentOffset。我使用了不同的方法,CABasicAnimation 或 UIView animateWithDuration 但问题是,在动画期间,我的 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;
}];
}
有什么建议吗?谢谢!
【问题讨论】:
-
你试过 self.scroll.clipToBounds = NO?
-
谢谢阿维!很好,现在我消除了正确的剪辑......现在我可以用 is 进行调查
-
Avi,我认为我正在将 UIScrollView 屏幕外向左移动,但我不明白为什么。如果我不调用动画,则 Scroll 正确地适合屏幕。
-
好的!如果我有一些延迟开始动画,使用 performSelectorWithObjectAfterDelay 工作正常!
-
大多数时候,如果你到了必须延迟开始某事的地步,这意味着代码有问题。我建议您仔细检查...我将在今天晚些时候尝试调查您的问题..
标签: ios uiscrollview core-animation