0

私の最初のObjective-Cプロジェクトとして、次のことを実装する必要があります。didSelectRowAtIndexPath

ここに画像の説明を入力してください

「Sikkerhed」と書かれている2行目はすべて無視できます。UITableView私が欲しいのは、私のセルが押されたときにキーボードと一緒にポップアップする新しいビューです。選択した行によって、設定するデータと表示するテキストが変わります。このようなものを実装するにはどうすればよいですか?UIViewControllerこれには新しいものが必要viewですか?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];

    // Code
}
4

2 に答える 2

0

あなたはしなければならない:

  1. UITableViewControllerを作成します
  2. テーブルビューのスタイルをグループ化に設定します

    あなたのコードでは:

  3. このチュートリアルのようにテーブルビューに入力します: http://windrealm.org/tutorials/uitableview_uitextfield_form.php

  4. viewControllerをdidSelectRowAtIndexPathに表示します。

    • UINavigationControllerのインスタンスを作成し、画面の一部のみを埋めるようにmodalPresentationStyleを設定します。

      navController.modalPresentationStyle = UIModalPresentationFormSheet;
      

      (modalViewControllersとModalPresentionStyleの詳細については、ここを参照してください) 。

    • カスタムUITableViewControllerのインスタンスをナビゲーションコントローラーにプッシュします。

      [self.navigationController pushViewController:anotherViewController];
      

お役に立てれば

于 2012-10-09T13:29:38.703 に答える
0

ええ、あなたはすることができます

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
   // find with cell has been pressed
   // with indexPath.row

   // instantiate your new viewController depending on the logic of the cell selected
   // for example
   MyCustomViewController* mcvc = [[MyCustomViewController alloc] initWithNibName:bundle]

   // do ur logic
   // Note, u should get your viewController embedded into a uinavigationContrlller, 
   // so you can
   [self.navigationController pushViewController: [mcvc autorelease] animated:YES];

}
于 2012-10-09T13:36:17.737 に答える