I have some view controller, and when I click some button I make modalView (wrapped with UINavigationController) and present it.
DscViewController *enterDescription = [[[DscViewController alloc] init] autorelease];
UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:enterDescription];
[self presentModalViewController:navController animated:YES];
[navController release];
The question is, how to make my (parent)view controller to be delegate, and when I click on some button at modalViewController (Done for example) to call some method in my parent viewController to dismiss modal and do some savings from modal input?
I don’t think that it’s good practice to make one controller blame its parent controller to do work that it should handel. You can always use
self.parentViewControllerto dismiss the modal you are currently in.If for some reason you only handle storage in the parentViewController then you can point your
donebutton action to a method in your current viewController and then useself.parentViewControllerto trigger the parent method for storage.or just set your buttons delegate directly to
self.parentViewController