2012-09-05 8 views
5

私のアプリを作成するためにストーリーボードを使用したいと思います。 ナビゲーションやタブコントローラーと一緒に使う方法については、たくさんの情報がありますが、私はそれらのいずれかをやっていません。ナビゲーションコントローラのないセグレス

私の目標は、ナビゲーションやタブコントローラーを使用せずに、さまざまなビューを持つアプリケーションを作成することです。 どうすればよいですか?

答えて

2

なぜあなたはそれらを望んでいないのですか?あなた自身のために仕事をしているようです。

表示可能なUIを持たないナビゲーションコントローラを持つことができます。これは、他のUIViewControllerをプッシュしてポップするだけで、デフォルトのプッシュセグのタイプが機能します。

本当にの場合は、いつでもcustom segue classを作成し、それを使用してコントローラスタックを管理することができます。

+1

あなたはストーリーボードでUIを隠すにはどうすればよいですか?そして、プログラマチックにViewControllerを押し込んでポップするにはどうしたらいいですか? – Crashalot

6

IOSストーリーボードでは、ナビゲーションを使用したくない場合はプッシュセグを使用できません。その後、モーダルセグまたはカスタムセグを使用することができます。しかし

  • 部分カール
  • 、これらの事前定義されたセグエアニメーションのすべてができない

  • 左右反転
  • クロスディゾルブ

    1. カバー垂直:モーダルセグエでは、4つの遷移がありますプレフォーム水平スライドアニメーションセグエ。水平スライディングエフェクトを使用する場合は、カスタムセグを使用する必要があります。

      - (void) perform 
      { 
      UIViewController *desViewController = (UIViewController *)self.destinationViewController; 
      
      UIView *srcView = [(UIViewController *)self.sourceViewController view]; 
      UIView *desView = [desViewController view]; 
      
      desView.transform = srcView.transform; 
      desView.bounds = srcView.bounds; 
      
      if(isLandscapeOrientation) 
      { 
          if(isDismiss) 
          { 
           desView.center = CGPointMake(srcView.center.x, srcView.center.y - srcView.frame.size.height); 
          } 
          else 
          { 
           desView.center = CGPointMake(srcView.center.x, srcView.center.y + srcView.frame.size.height); 
          } 
      } 
      else 
      { 
          if(isDismiss) 
          { 
           desView.center = CGPointMake(srcView.center.x - srcView.frame.size.width, srcView.center.y); 
          } 
          else 
          { 
           desView.center = CGPointMake(srcView.center.x + srcView.frame.size.width, srcView.center.y); 
          } 
      } 
      
      
      UIWindow *mainWindow = [[UIApplication sharedApplication].windows objectAtIndex:0]; 
      [mainWindow addSubview:desView]; 
      
      // slide newView over oldView, then remove oldView 
      [UIView animateWithDuration:0.3 
             animations:^{ 
              desView.center = CGPointMake(srcView.center.x, srcView.center.y); 
      
              if(isLandscapeOrientation) 
              { 
               if(isDismiss) 
               { 
                srcView.center = CGPointMake(srcView.center.x, srcView.center.y + srcView.frame.size.height); 
               } 
               else 
               { 
                srcView.center = CGPointMake(srcView.center.x, srcView.center.y - srcView.frame.size.height); 
               } 
              } 
              else 
              { 
               if(isDismiss) 
               { 
                srcView.center = CGPointMake(srcView.center.x + srcView.frame.size.width, srcView.center.y); 
               } 
               else 
               { 
                srcView.center = CGPointMake(srcView.center.x - srcView.frame.size.width, srcView.center.y); 
               } 
              } 
             } 
             completion:^(BOOL finished){ 
              //[desView removeFromSuperview]; 
              [self.sourceViewController presentModalViewController:desViewController animated:NO]; 
             }]; 
      } 
      

      まだ問題が解決しない場合は、この投稿を確認してください。また、このカスタムセグエを実装する方法をお見せするためにユーチューブのビデオを持っている:

      Create Push Segue Animation Without UINavigation Controller

  • +0

    インターネットでもこの解決策が見つかりました:http://stackoverflow.com/questions/15139909/auto-layout-screen-rotation-and-uiview-animation/20958850#20958850 – asdfasdfads

    関連する問題