簡単にするために、View Controller 内の関数間でデータを共有するにはどうすればよいでしょうか? 理想的には、NSMutableDictionary を使用したいのですが、私のアプローチはうまくいかないようです (以下):
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"];
...
}
エラーで終了: '不明な受信者 'movieItem'. 入力していただきありがとうございます。