Aiming for simplicity, how does one share data among functions within a view controller? Ideally, I would like to use a NSMutableDictionary, but my approach doesn’t seem to work (below):
In ViewController.m:
- (void) viewDidLoad{
...
NSMutableDictionary * movietem = [[NSMutableDictionary alloc] init];
[movieItem setValue:@“frozen” forKey:@“title” ];
[movieItem setValue:@“PG” forKey:@“rating” ];
[movieItem setValue:@“tom cruise” forKey:@“cast” ];
....
}
-(IBAction) updateTitleBtn:(UIButton *)sender{
…
[movieItem setValue:@"lion king" forKey:@"title"];
...
}
-(IBAction) updateCastBtn:(UIButton *)sender{
…
[movieItem setValue:@"forest whitaker" forKey:@"cast"];
...
}
Concluding in an error: ‘Unknown receiver ‘movieItem’. Thanks for the input.