【问题标题】:UIScrollView clipped during animationUIScrollView 在动画期间被剪辑
【发布时间】: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


【解决方案1】:
[UIView animateWithDuration:5.0f animations:^ {
    [scrollView setContentOffset:destination animated:NO];
}];

为我工作

【讨论】:

  • Thanbks Lithu,我认为我的 UIScrollView 边界有问题...我正在尝试找到它;)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-06-06
  • 2012-11-22
  • 2015-06-15
  • 1970-01-01
相关资源
最近更新 更多