-1

我在导航控制器中有两个表视图控制器。Cloth 表是主视图,当我单击其中一个单元格时,转到另一个提供详细信息的视图控制器,当我选择我想要的选项并返回导航按钮的返回时,我会丢失信息。如何将值带到主视图?

这是我的代码:主视图 - 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 ];   

}

4

1 回答 1

0

我通过使用本教程解决了我的问题。(简单的 ios 开发委托教程)

于 2013-02-26T15:49:15.733 回答