我使用子视图初始化UIScrollView。按下按钮后,我要:
动画结束后,
为此,我执行以下操作:
[mCubeView setContentOffset:tOffset animated:YES];
[tActualSide removeFromSuperview];
问题在于,动画开始后,“tActualSide”会立即删除,并且也会从动画中删除。
我想与之同步,即tActualSide仅在动画结束时才被删除。
我怎样才能做到这一点?
最佳答案
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve: UIViewAnimationCurveLinear];
[mCubeView setContentOffset:tOffset];
[UIView commitAnimations];
[self performSelector:@selector(remove) withObject:nil afterDelay:0.5f];
- (void)remove
{
[tActualSide removeFromSuperview];
}
关于ios - iOS scrollView setContentOffset同步问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11723594/