-1

数十のチュートリアルとサンプル コードを試して、さまざまなビュー コントローラーに移動し、最初の「メニュー」ビュー コントローラーに戻ることができるアプリの初期メニューを作成しようとしました。

ボタン付きの通常のView Controllerを試しましたが、それぞれから別のView Controllerにセグエを実装しようとするとエラーが発生しました。ナビゲーションコントローラーにラップされたテーブルビューコントローラーを使用して開始しようとしましたが、各セルを別のビューコントローラーにセグエ化し、「メニュー」コントローラーに戻ることができる例が見つかりませんでした。

これは一般的なタイプのナビゲーション シナリオのようですが、これを実現する方法の例が見つからないのはなぜですか? これらの線に沿った何かの例への提案やリンクはありますか?

4

1 に答える 1

0

これを行うには、次の 2 つの方法を使用できます。

  1. ボタンとメイク ボタン アクションを使用して、別のビューに移動します。

  2. TableView セルの使用。

これがtableViewセルのコードです

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView          
{
   //Return the number of buttons you have
}
- (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section
{
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
       //You can use either switch cases to load the table view with the buttons you have.
}


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
  [tableView deselectRowAtIndexPath:indexPath animated:YES];
      switch(indexPath.Section)
      {  
         Case 0:
         {
              //Code to push new controller
         }
      }
 }
于 2013-01-01T19:35:31.773 に答える