これに関するいくつかの質問を見てきましたが、この問題を解決するのに役立つものはありませんでした。
私は MasterViewController -> AViewController -> BViewController を持っています
ドキュメントには次のように記載されています。
表示側のビュー コントローラーは、表示されたビュー コントローラーを閉じる役割を果たします。ただし、提示されたView Controller自体でこのメソッドを呼び出すと、メッセージが提示元のView Controllerに自動的に転送されます。
[self.presentingViewController dismissModalViewControllerAnimated: YES];
B VC からこのメソッドを呼び出すと、A VC と B VC が破棄されます。それでも、それは子供を解雇するだけです(B VC)。なんで?
- (IBAction)checkButton:(UIButton *)sender {
NSManagedObjectContext * context = [myAppDelegate managedObjectContext];
Work * newWork = [NSEntityDescription insertNewObjectForEntityForName:@"Work" inManagedObjectContext:context];
[newWork setName:_workName];
[myAppDelegate saveContext];
NSLog(@"%@", [self.presentingViewController description]);
[self.presentingViewController dismissModalViewControllerAnimated: YES];
}
関連性があるかどうかはわかりませんが、A と B の VC は次のように提示されています。
TWWorkNameViewController *controller = (TWWorkNameViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"WorkName"];
[self presentViewController:controller animated:YES completion:nil];