我刚刚开始使用Storyboards并想Segue为 Transistion 编写一个自定义类。
过渡:我有一个电流ViewController A,当我初始化时ViewController B,ViewController A滑到底部并ViewController B出现在后面ViewController A。对于nib文件,我只是将两个 ViewController 放入一个 Container 中,但我想在InterfaceBuilder
脚步
- 创造
ViewController B - 放在
ViewController B后面ViewController A - 移出
ViewController A底部 - 节目
ViewController B
到目前为止我尝试过的是这个
- (void)perform
{
//#1
UIViewController *sourceViewController = (UIViewController *) self.sourceViewController;
UIViewController *destinationViewController = (UIViewController *) self.destinationViewController;
//#2
// [sourceViewController.view insertSubview:destinationViewController.view aboveSubview:sourceViewController.view] ;
[UIView animateWithDuration:2.0
animations:^{
//#3
sourceViewController.view.transform = CGAffineTransformMakeTranslation(0, sourceViewController.view.layer.frame.size.height);
}
completion:^(BOOL finished){
//#4
[[self sourceViewController] presentModalViewController:[self destinationViewController] animated:NO];
}
];
}
我的问题是#2:我怎样才能让新的 ViewController “落后于”当前的 ViewController?并且只为其中一个设置动画?