2016-05-28 11 views
0

UIStoryboardSegue私は自分自身で、UIViewが「スライド」するように、sourceViewControllerからdestinationViewControllerに書き込もうとしています。現在、私は以下のコードを持っています:カスタムUIStoryboardSegueが動作しません

- (void)perform { 
    UIViewController *sourceViewController = self.sourceViewController; 
    UINavigationController *navigationController = [[self sourceViewController] navigationController]; 
    RestaurantViewController *destinationViewController = self.destinationViewController; 

    destinationViewController.colors.frame = CGRectMake(0, 0, 10, 10); 

    [sourceViewController.view addSubview:destinationViewController.tables]; 

    [UIView animateWithDuration:10.0 
          delay:0.0 
         options:UIViewAnimationOptionCurveEaseInOut 
        animations:^{ 
         destinationViewController.tables.frame = CGRectMake(100, 100, 100, 100); 
        } 
        completion:^(BOOL finished){ 
         [destinationViewController.tables removeFromSuperview]; // remove from temp super view 
         [navigationController pushViewController:destinationViewController animated:NO]; // present VC 
        }]; 
} 

テストとして、私はちょうどテーブルビューのフレームで遊んでいます。私はまた、何かを見ることができるように、期間を約10秒に設定しました。しかし、destinationViewControllerは、私が書いたすべてのコードを完全に無視しています。私はここで間違って何をしていますか?

答えて

0

こんにちは私はあなたのコードでこの作業をしようとしていますが、あなたの主な問題はあなたのdestinationViewController.tablesが何も動作しないように見えるということです。

あなたはあなたのdestinationViewController.tablesがnilでないことを確保する必要がある、あなたはこの

- (instancetype)initWithCoder:(NSCoder *)coder 
     { 
     self = [super initWithCoder:coder]; 
     if (self) { 
      self.tables = [[UIView alloc]initWithCoder:coder]; 
     } 
     return self; 
     } 

・ホープ、このヘルプあなたのような何かをあなたのRestaurantViewControllerクラスでこれを行うことができます。私の英語には申し訳ありません

関連する問題