我不确定我到底明白了什么transitionFromViewController:toViewController:duration:options:animation:completion:
。它只是一种方便的方法吗?
例如,这样做有什么区别......
[self transitionFromViewController:fromViewController
toViewController:toViewController
duration:0.25
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
fromViewController.view.alpha = 0;
toViewController.view.alpha = 1;
} completion:^(BOOL finished) {
[fromViewController removeFromParentViewController];
[toViewController didMoveToParentViewController:self];
}];
...还有这个?
[self.view addSubview:toViewController.view];
[UIView animateWithDuration:0.25
delay:0
options:UIViewAnimationOptionCurveEaseOut
animations:^{
fromViewController.view.alpha = 0;
toViewController.view.alpha = 1;
} completion:^(BOOL finished){
[fromViewController.view removeFromSuperview];
[fromViewController removeFromParentViewController];
[toViewController didMoveToParentViewController:self];
}];
我问的原因是在某些情况下我需要将子控制器视图添加到容器控制器视图的特定子视图中。使用transitionFromViewController:toViewController:duration:options:animation:completion:
没有给我这个选项。