目标C:Segue哪个滑到底部并取消隐藏新的ViewController?

时间:2013-11-12 15:50:21

标签: objective-c uiviewcontroller interface-builder

我刚刚开始使用Storyboards并希望为Transistion编写自定义Segue类。

Transistion :我有一个当前ViewController A,当我初始化ViewController B时,ViewController A滑到底部,ViewController B出现在ViewController A后面{ {1}}。使用nib文件,我只是将ViewController放到一个Container中,但我希望在InterfaceBuilder

内实现相同的功能。

步骤

  1. 创建ViewController B
  2. ViewController B放在ViewController A
  3. 后面
  4. ViewController A移出底部
  5. 显示ViewController B
  6. 到目前为止我尝试过的是

    - (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“落后”当前的那个?并且只为其中一个制作动画?

1 个答案:

答案 0 :(得分:0)

您可能想要探索ECSlidingViewController @ https://github.com/edgecase/ECSlidingViewController。我们有与您相似的要求,我们使用了这个MIT许可证类。