2012-03-16 48 views
0

我想加載另一個視圖控制器,以便當新的一個來自底部時,它當前滑動,它的工作原理,但我沒有得到子視圖(按鈕消失,我只得到空白視圖),如何解決它?自定義iPhone故事板segue無法正常工作

當前的代碼:

-(void)perform { 
    UIViewController *sourceVC = (UIViewController *) self.sourceViewController; 
    UIViewController *destinationVC = (UIViewController *) self.destinationViewController; 

    [UIView animateWithDuration:2.0 
        animations:^{ 
         destinationVC.view.frame=CGRectMake(destinationVC.view.frame.origin.x, 480, destinationVC.view.frame.size.width, destinationVC.view.frame.size.height); 
         sourceVC.view.transform=CGAffineTransformMakeTranslation(0, -480); 
         destinationVC.view.transform=CGAffineTransformMakeTranslation(0, -480); 

        }]; 

} 
+0

你確定VC已經加載動畫內嗎?你爲什麼使用VC? U可以爲單獨的視圖設置動畫... – Injectios 2012-03-16 09:19:02

+0

這是什麼意思? – 1337code 2012-03-16 09:23:51

回答

0

您可以創建2次爲您的viewController,並設置第二種觀點origin.y = window.height 然後動畫這樣的 -

CGRect outFrame = CGRectMake(0, 320, 320, 322); 

[UIView animateWithDuration:0.50f 
         delay:delay 
        options:UIViewAnimationOptionCurveEaseInOut 
       animations:^{ 
        fromView.frame = outFrame; 
        toView.frame = CGRectMake(0, 0, 320, 322); 
       } completion:nil]; 

像這...

+0

如何在故事板中添加另一個視圖ti viewController? 它不允許我添加它... – 1337code 2012-03-16 09:56:31

+0

毫米...對不起,我忘了你使用故事板 – Injectios 2012-03-16 10:10:26