2

私はtableViewで開くアプリに取り組んでいます。セルが選択されると、ユーザーは最初のtableViewで選択された最初のセルに関連するオプションの2番目のtableViewに移動します。2 番目の tableView で、ユーザーはもう 1 つのセルを選択する必要があり、詳細ビューが表示されます。

最初の tableView が正しく表示されており、2 番目の tableView にも本来あるべきものが表示されています。問題は、2 番目の tableView で何かを選択し、詳細ビューに移動することです。詳細ビュー画面が表示されますが、空です。

NSLogs を追加して、NSSet に何かが含まれているかどうかを確認しようとしましたが、何も表示されないようです。SQLファイルを調べたところ、データが含まれているため、書き込まれていることがわかります。唯一の問題は、それにアクセスすることです。

2 番目の tableView 画面の prepareForSegue のコードは以下のとおりです。ひどく間違っているところがあれば教えてください。

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{

if ([segue.identifier isEqualToString:@"toExplanation"]) {


    NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
    ExplanationViewController *destViewController = segue.destinationViewController;

    NSSet *optionChoices = [[self threeScreen] theOptions];
    _selectionContent = [optionChoices allObjects];
    NSLog(@"%@",[optionChoices allObjects]);
    NSSortDescriptor *nameSort = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES];
    NSArray *sortedChoices = [optionChoices sortedArrayUsingDescriptors:[NSArray arrayWithObject:nameSort]];
    NSLog(@"%@", sortedChoices);


    Option *option = [sortedChoices objectAtIndex:indexPath.row];
    destViewController.explainToMe = option.explanation;
    //destViewController.explainToMe = @"Working?";
    NSLog(@"%@",option.explanation);

}

'destViewController.explaintToMe = @"Working?"; のコメントを外すと、「作業中?」と表示されます。詳細ビューで。

4

0 に答える 0