Navigation Controller に 2 つの Table View Controller があります。クロス テーブルがメイン ビューです。セルの 1 つをクリックすると、別のビュー コントローラに移動して詳細が表示されます。必要なオプションを選択して [ナビゲーション] ボタンの [戻る] に戻ると、情報が失われます。値をメイン ビューに表示するにはどうすればよいですか?
ここに私のコード:メインビュー - AddClothViewController
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([[list objectAtIndex:indexPath.row] isEqual:@"Categorias"] )
{
CategoriesViewController *DVC = [[CategoriesViewController alloc] initWithNibName:@"CategoriesViewController" bundle:nil];
[self.navigationController pushViewController:DVC animated:YES];
}
}
ここに私のコード: カテゴリ ViewController
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Set the checkmark accessory for the selected row.
[[tableView cellForRowAtIndexPath:indexPath] setAccessoryType:UITableViewCellAccessoryCheckmark];
// This is my main View Controller when i declare a variable category and I try to access from
//here
AddClothViewController *DVC = [[AddClothViewController alloc] initWithNibName:@"AddClothViewController" bundle:nil];
DVC.clothNew.categoria = [list objectAtIndex:indexPath.row ];
}