我使用子视图初始化UIScrollView.按钮操作后,我想:
为此,我做了以下事情:
[mCubeView setContentOffset:tOffset animated:YES];
[tActualSide removeFromSuperview];
Run Code Online (Sandbox Code Playgroud)
问题是,在动画开始后,"tActualSide"立即被删除,它也将从动画中删除.
我想同步它,只有在动画结束时才会删除tActualSide.
我怎样才能做到这一点?
听取代表回调:
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
Run Code Online (Sandbox Code Playgroud)
当你收到那条消息时
[tActualSide removeFromSuperview];
Run Code Online (Sandbox Code Playgroud)
引用Apple文档(请注意"setContentOffset:animated:"参考):
scrollViewDidEndScrollingAnimation:
Tells the delegate when a scrolling animation in the scroll view concludes.
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
Parameters
scrollView
The scroll-view object that is performing the scrolling animation.
Discussion
The scroll view calls this method at the end of its implementations of the UIScrollView and setContentOffset:animated: and scrollRectToVisible:animated: methods, but only if animations are requested.
Availability
Available in iOS 2.0 and later.
Declared In
UIScrollView.h
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1360 次 |
| 最近记录: |