私はx行のTableViewControllerを持っています。ユーザーが1つの行をタップすると、2番目のtableViewControllerがロードするデータを決定する変数を2番目のtableViewControllerに渡します。どうすればいい?変数をtableviewから2番目のtableviewに渡す方法は?
私はXcodeの4.2を使用しています、ストーリーボード はここのコードです:「ヘッド」私はその二テーブルビューショーのデータに応じて、第二テーブルビューに渡す必要があり数を取得
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *__strong)indexPath
{
// Navigation logic may go here. Create and push another view controller.
TestTable *detail = [self.storyboard instantiateViewControllerWithIdentifier:@"TestTable"];
[self.navigationController pushViewController:detail animated: YES];
detail.num = [NSString stringWithFormat:[heads objectAtIndex:indexPath.row]];
で。最後の行が "num"に "heads"をロードしているかどうかはわかりません。私のアプローチは正しいのですか? ヘルプ/リファレンスは評価されています
ヘッドは何ですか?あなたの質問をより明確にする。 – Sarah
headsは可変配列(単純に整数を含む)です。 – jason
cell.textLabel.text = [heads objectAtIndex:indexPath.row]; – jason