简体   繁体   English

当我在TabBarController中切换视图时,ScrollView停止滚动,如何解决?

[英]When i switch View In TabBarController the ScrollView Stop Scroll,How to Solve it?

in Controller A: here the Code: 在控制器A中:代码如下:

[UIView animateWithDuration:5 animations:^{
    [self.awardScrollView setContentOffset:CGPointMake(self.awardScrollView.frame.size.width * 19, 0)];
} completion:^(BOOL finished) {
    isFinished = YES;
}];

i set 5s to finish the animation,but i switch controller to B with TabBarController ,i found the animation is stop in Controller A.How can i let the ScrollView continue Scroll Background in Controller A even i Switch to Controller B ? 我将5s设置为完成动画,但是我使用TabBarController将控制器切换到了B ,我发现动画在Controller A中停止了。即使我切换到Controller B ,我如何也可以让ScrollView在Controller A中继续滚动背景?

Core Animation won't animate a view that's not in the on-screen view hierarchy. Core Animation不会为不在屏幕视图层次结构中的视图设置动画。 When a view is removed from the on-screen view hierarchy, Core Animation removes all animations from the view. 从屏幕上的视图层次结构中删除视图时,Core Animation将从视图中删除所有动画。

You can add another animation when the view comes back on screen if you want. 如果需要,可以在视图重新显示在屏幕上时添加其他动画。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 滚动视图滚动时如何检查视图可滚动位置 - How to check view scrollable position when scrollview scroll 当我在tabBarController中的选项卡之间切换时,将调用哪个方法? - which method will be called when i switch between tabs in tabBarController? 自定义scrollView滚动时,移动标题视图 - Custom scrollView when Scroll, move header view 当scrollview快速滚动时,如何滚动collectionView? - How can I scroll collectionView when scrollview scrolls in swift? 当我从另一个视图选择回到视图时,TabBarController消失了 - TabBarController disappears when I segue back to the view from another view 切换标签栏视图时如何停止播放视频 controller - How to stop video from playing when switch tabbar view controller 如何与作为滚动视图子视图的水平滚动视图进行交互? - How to interact with a horizontal scrollview that is a subview of a scroll view? 如何仅禁用 ScrollView 中的滚动而不禁用内容视图? - How to only disable scroll in ScrollView but not content view? TabBarController-切换选项卡保持横幅视图; - TabBarController - switch tab keeping banner view; 当图像向滚动视图的边缘移动时,如何使滚动视图滚动 - How to make scrollview scroll when image is moved towards edge of the scrollview
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM