我需要在我的导航控制器中创建一个类似于pushViewController:viewController animated:YES方法的方法,但我需要在视图控制器的框架顶部添加 80px,同时它执行从左到右的转换。但是,下面的方法会引发以下错误:
父视图控制器在调用 -[UIViewController transitionFromViewController:toViewController:duration:options:animations:completion:]' 时使用了遗留容器
- (void)transitionFrom:(UIViewController *)oldController To:(UIViewController *)newController
{
[self addChildViewController:newController];
//[self configureChild:newController];
[newController.view setFrame:CGRectMake(320, 80, oldController.view.frame.size.width, oldController.view.frame.size.height)];
[self transitionFromViewController:oldController
toViewController:newController
duration:0.5
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^{
[oldController.view setFrame:CGRectMake(-320, 80, oldController.view.frame.size.width, oldController.view.frame.size.height)];
[newController.view setFrame:CGRectMake(0, 80, newController.view.frame.size.width, newController.view.frame.size.height)];
}
completion:^(BOOL finished){
//[oldController willMoveToParentViewController:nil];
[oldController removeFromParentViewController];
[newController didMoveToParentViewController:self];
}];
}