0

Master-Detailアプリケーションがあります。ユーザーがMasterTableの行を選択したときに、別のテーブル(DetailViewControllerではない)を開きたいと思います。iPadのFacebookアプリと同様に、MasterViewControllerのほかに紙に書く必要があります。

MasterViewControllerからこのテーブル(タイプUITableViewControllerのDocumentViewController)へのカスタムセグエがあります。このDocumentViewControllerは、ナビゲーションコントローラーに「埋め込まれています」。

要するに、私のストーリーボードのアイテムは次のようになります。

NavigationController-> MasterViewController->NavigationController->DocumentViewController。

セグエはMasterViewControllerからnavigationControllerまでです。

「didSelectRowAtIndexPath」でセグエを実行する必要がありますか?または、didSelectRowAtIndexPathで「performSegueWithIdentifier」を使用する必要がありますか?

4

1 に答える 1

1

私があなたの質問を正しく理解していれば、セグエはMasterViewControllerからDocumentViewControllerになっているはずです。必ず一意の識別子を指定してから、MasterViewControllerのprepareForSegueで実行する操作を参照してください。

例:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([[segue identifier] isEqualToString:@"showList"]) {

        // gets indexPath for the currently selected row in my UITableView
        NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];

        // pull back some useful data from Core Data according to what was selected in my UITableView.
        NSManagedObject *object = [[self fetchedResultsController] objectAtIndexPath:indexPath];

        // listDataItem is a property of the controller (in this case a UITableViewController)
        [[segue destinationViewController] setListDataItem:object];
    }
}
于 2012-08-16T06:35:36.553 に答える