IngredientViewController

IngredientViewController

我试图让IngredientViewController更新一个数组,该数组属于通过segue(FridgeViewController)调用它的控制器

IngredientViewController里,无论我怎么尝试,littleManager都为零

代码:

FridgeViewController:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
    IngredientViewController *controller = (IngredientViewController *)segue.destinationViewController;
    [controller setFridgeManager:fridgeManager];
}


IngredientViewController:

@property (strong, nonatomic) FridgeDataManager *fridgeManager;


并且在viewDidLoad fridgeManager为nil(以及任何其他粗略方法)

最佳答案

在IngredientViewController.m中合成这个RefrigeratorManager属性

@synthesize fridgeManager;

10-08 09:26