2012-10-09 42 views
0

一個可編輯的TextView作爲我的第一個Objective-C的項目曾經我需要實現didSelectRowAtIndexPath添加在didSelectRowAtIndexPath方法

enter image description here

下可以忽略的,上面寫着「Sikkerhed」第二行的一切。我想要的是當按下我的UITableView中的一個單元格時,隨鍵盤彈出的新視圖。正在設置的數據和正在顯示的文本將根據所選行被更改。我如何去執行這樣的事情?我需要一個新的UIViewController這個view

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

    // Code 
} 

回答

0

您將有:

  1. 創建的UITableViewController
  2. 設置的tableview的風格分組

    在您的代碼:

  3. 填寫的tableview想在這個教程: http://windrealm.org/tutorials/uitableview_uitextfield_form.php

  4. 出示您的viewController在didSelectRowAtIndexPath方法:

    • 創建的UINavigationController的一個實例,並設置modalPresentationStyle只填充屏幕的一部分:

      navController.modalPresentationStyle = UIModalPresentationFormSheet; 
      

      (你可以找到有關的更多信息modalViewControllers和ModalPresentionStyle例如here

    • 推自定義的UITableViewController的導航控制器上的一個實例:

      [self.navigationController pushViewController:anotherViewController]; 
      

希望這有助於

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]; 

} 
相關問題